You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there! Huge fan of this plugin - it's rapidly becoming one of my go-to tools for building sites these days.
I use my website as a central hub, which means that I post everything on there, including tweets, blog posts, and externally written content that backlinks to the original posts.
This means that I need to display content differently based on the post format, particularly when I'm working with a query loop block, and want to show micro posts so that they look like "tweets", sharing the full post content, and then blog posts as a more traditional post with a featured image and excerpt.
Post Formats is a theme feature introduced with Version 3.1. A Post Format is a piece of meta information that can be used by a theme to customize its presentation of a post. The Post Formats feature provides a standardized list of formats that are available to all themes that support the feature. Themes are not required to support every format on the list. New formats cannot be introduced by themes or even plugins. The standardization of this list provides both compatibility between numerous themes and an avenue for external blogging tools to access this feature in a consistent fashion.
I'm able to accomplish this using this plugin by filtering post content based on the post format:
The Problem
The problem is that this plugin doesn't support filtering by post format. I have found a workaround that allows me to filter based on post meta, using a filter, but it would be nice to be able to directly filter by post formats, if they're supported in the theme.
<?php/*Plugin Name: Post Format As Post MetaDescription: Adds a hook that makes it possible to access the current post */add_filter('get_post_metadata', function ($value, $post_id, $meta_key, $single) {
if ('_as_post_format' === $meta_key) {
// Get the post format for the post$post_format = get_post_format($post_id);
if ($post_format) {
return$post_format;
} else {
return'standard';
}
}
return$value;
}, 10, 4);
What is your proposed solution?
It would be nice if:
Post filtering could be done based on the value of the post format function in WordPress. This can be done using get_post_format.
Filtering would be enabled if the theme supports any post formats, and formats could be selected from the list of formats that are supported by the theme, eg: get_theme_support('post-formats')
By doing this, I would no-longer need to use the meta key hack I mentioned above, and could instead directly filter based on the post format.
The text was updated successfully, but these errors were encountered:
What problem does this address?
Hello there! Huge fan of this plugin - it's rapidly becoming one of my go-to tools for building sites these days.
I use my website as a central hub, which means that I post everything on there, including tweets, blog posts, and externally written content that backlinks to the original posts.
This means that I need to display content differently based on the post format, particularly when I'm working with a query loop block, and want to show micro posts so that they look like "tweets", sharing the full post content, and then blog posts as a more traditional post with a featured image and excerpt.
I'm able to accomplish this using this plugin by filtering post content based on the post format:
The Problem
The problem is that this plugin doesn't support filtering by post format. I have found a workaround that allows me to filter based on post meta, using a filter, but it would be nice to be able to directly filter by post formats, if they're supported in the theme.
What is your proposed solution?
It would be nice if:
get_theme_support('post-formats')
By doing this, I would no-longer need to use the meta key hack I mentioned above, and could instead directly filter based on the post format.
The text was updated successfully, but these errors were encountered: