4 Answers
4

You can't actually pass a taxonomy-related argument to get_posts().(Edit: actually, yes you can. The Codex is just somewhat unclear. Looking at source, get_posts() is, at its heart, just a wrapper for WP_Query().) You can pass meta keys/values, and post types, but not taxonomies such as post format. So for this line:

thanks, you made it really easy for a beginner to understand by breaking it down nicely. I'm guessing since I only use aside, link and standard post formats, I can actually skip the rest.
– dabaApr 13 '12 at 21:37

1

Yes; you would only need to include whichever post formats you've enabled support for.
– Chip BennettApr 13 '12 at 21:43

get_posts() actually utilises WP_Query, so of course you can pass in taxonomy queries, just pass them as an array and not as a query string.
– shabushabuApr 14 '12 at 10:45

Post formats are just predefined terms in a taxonomy called post_format, so you should be able to use the WP template hierarchy to create post format archives. Just create a file called taxonomy-post_format-post-format-standard.php in the root of your theme and that file will be used to output all your standard posts. You can substitute 'standard' with any of the other format names, like aside, link or video, so e.g. taxonomy-post_format-post-format-video.php. This works for any other taxonomy as well, btw, as long as you stick to this format: taxonomy-{TAXONOMY_NAME}-{TERM_NAME}.php

If you want to show post formats with a custom loop, e.g. in your sidebar or within a page template, then you can use the tax query from @kaiser. Just substitute the taxonomy with post_format and the slugs with post-format-{FORMAT_NAME}.

actually this does work, but you'll get into trouble, when you consider paging. if you do something like 'posts_per_page' => 6 and have 4 posts with NOT standard template, you will only see 2 posts, not the 6 that should be visible. filtering the query is the proof way to go..
– honk31Jul 20 '15 at 19:16