3

What should I call the archive file for a post format? Ex archive-gallery.php? (doesn't work)

I would like to create a list of all the gallery formats with a preview and some custom taxonomies thrown in.

2 Answers 2

4

Well.... for querying, formats are a taxonomy parameter...so that should work.... http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Lemme loook...

And yep, here's how that works http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display

taxonomy-post_format-post-format-link.php

2
  • Thanks @Rev. Voodoo ... that should be listed in the Post Format Codex somewhere. :)
    – MTT
    Jun 10, 2011 at 19:58
  • Probably a good idea. I guess there isn't really anything there letting you know that a post format is handled as a taxonomy.... The codex is open for anyone to edit (maybe I'll do it, if my writing skills are decent!) Jun 13, 2011 at 11:18
4

You don't need to create a custom template for the archive index for Post Format types. Your existing template files (taxonomy.php, archive.php, or index.php) will display them just fine.

Just use the following URL structure: www.example.com/type/{format}/, which for galleries, would be www.example.com/type/gallery/.

See here for a thorough explanation.

3
  • archive-postformat does not work so I assume it should be archive-post-format.php. I'll have to try that. Thanks!
    – MTT
    Jun 10, 2011 at 19:59
  • 1
    If you want to create a custom template file, the name would be taxonomy_post_format-post-format-{type}.php, which, for Galleries, would be taxonomy_post_format-post-format-gallery.php. But, again: I think using such custom template files is overkill. Jun 10, 2011 at 20:49
  • Ahh I was had a - where I needed a _ :)
    – MTT
    Jun 10, 2011 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.