I want a page to view only a specific post format (e.g. aside).
Do I have to create my own page and run a custom query, or does Wordpress have an automatic page generated for me (like the categories)?
Take a look at get_post_format_link()
Here's a little example that uses get_post_format_link()
to show a link to the format's archive page. You can see something similar to this in action on Justin Tadlock's site.
function get_post_format_archive_link() {
return sprintf(
'<a class="post-format-archive-link %1$s" href="%2$s">%1$s</a>',
get_post_format(),
get_post_format_link( get_post_format() )
);
}
usage:
echo get_post_format_archive_link();
The URL Structure is:
/type/{post format}/
So for an aside we'd have:
http://example.com/type/aside/
get_post_format_link()
& get_post_format_arhive_link()
?
get_post_format_archive_link()
is just an example that uses the WP core function get_post_format_link()
. The output of get_post_format_archive_link()
makes styling the individual links easier, but get_post_format_link()
does all the real work here.
Commented
Jan 31, 2012 at 6:36
You would need to add theme support for post formats with code.
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
The code above is what you'd put in your theme's functions.php
file, and then in your template files, you would display each post accordingly with the following code, for example if your post format for a post was video
:
if ( has_post_format( 'video' )) {
echo 'this is the video format';
}
See the Codex for more info:
http://codex.wordpress.org/Post_Formats#Adding_Theme_Support
aside
post format. What I want now is a page that displays only the posts with the aside
post format applied to them. Now, I could create my own page and run a custom query, but I wanted to know if there's a pre-built page for that, similar to how Wordpress automatically creates pages for categories...