Can somebody please point me in the right direction on how to set up a custom post type archive page on a child theme of Thematic, and query for the custom post type.
e.g. archive-customposttype.php
Thanks
Can somebody please point me in the right direction on how to set up a custom post type archive page on a child theme of Thematic, and query for the custom post type.
e.g. archive-customposttype.php
Thanks
If it were me, I would modify this plugin by Devin Price, http://wptheming.com/2011/08/portfolio-post-type-plugin/
It is currently set up for the cpt of "portfolio", but could easily be modified to what you need. The benefit is if you do the cpt as a plugin, you can retain some of the information from theme to theme vs. building into the functions php, which you could do to.
Also he has a cpt resource list which I know I have used a bunch of times, good info, http://wptheming.com/2010/07/custom-post-type-resources/
wp does custom post type archives by default if you set archive to true when you register the post type:
has_archive => true
the slug defaults to the post type name so if you registered "portfolio" your archive would be at www.yoursite.com/portfolio
http://codex.wordpress.org/Function_Reference/register_post_type
you don't need a custom query at all.
http://codex.wordpress.org/Template_Hierarchy#Custom_Post_Types_display
thematic will display this using its archive.php template (or failing that b/c i really can't remember if it has one right now.. index.php). you can override that by dropping an archive-portfolio.php into your child theme.
Thanks. And when creating a new page to display this archive, what's the best way to link to this archive from the nav menu, without having to create a custom template page?
unfortunately i don't think you can add the archive in the WP menu (even if you set the post type to allow it to be shown in the menus). you'll need a custom link i think... and point it to the archive's URL. something i hope they fix for post type and tax archives in one of the next releases
This topic has been closed to new replies.