WordPress.org

Support

Support » How-To and Troubleshooting » Custom Post Type Archive Page

Custom Post Type Archive Page

  • I’ve created a custom post type “breeding_projects” with the help of Types plugin. I’ve also created two custom taxonomies associate with this post type “breeder” and “genus”.

    I’ve created templates single-breeding_projects.php and archive-breeding_projects.php

    The single template works great. Everything functions perfectly there displaying the content as I’d like. However, the archive template doesn’t even get used. My archive for this post type keeps wanting to use archive.php instead. I’m now stuck on how to get it to be used. I can’t even see if my template needs changed since it won’t access my template.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You need to edit the custom post type and set ‘has_archive’ to ‘true’. It’s an advanced setting 🙂

    Thanks, Keith, but that’s already set.

    It HAS an archive and displays. It just doesn’t use the template I designed for it. I’m trying to figure out why it uses the standard archive.php template instead of the archive-breeding_projects.php template.

    Moderator keesiemeijer

    @keesiemeijer

    Does the archive-breeding_projects.php template have a custom page template header?
    http://codex.wordpress.org/Page_Templates#Custom_Page_Template

    If so remove it.

    try:
    – switching to the default theme to rule out any theme-specific problems.

    keesiemeijer –

    Removed the header, still no luck. I guess I can try switching themes tomorrow morning. Could you shed light on what from a theme may cause the issue? (So I know what to hunt for if that is the problem)

    Thanks

    Moderator keesiemeijer

    @keesiemeijer

    Try re-saving your permalink structure in wp-admin > Settings > Permalinks.

    There are many ways to alter the default template. Look for something like “template_include”.
    http://codex.wordpress.org/Plugin_API/Filter_Reference/template_include

    Thanks. I’ll hunt for that kind of stuff. Had already tried re-saving permalinks, bit I’ll try it again. I’ve done some other things since then to try to sort things out.

    No luck on the permalinks.

    Moderator keesiemeijer

    @keesiemeijer

    Thing to try:

    – flushing any caching plugins you might be running, as well as server and/or browser caches.

    – deactivating all (other than the types) plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

    Didn’t think to flush supercache. Great call there.

    Thole plugins and themes are the last steps I often take, just cause of how much that “shuts down” my site. But they are on my list.

    Thanks for all the help. It also sounds like, in theory, my post type and taxonomy setup is right, there’s just something else keeping it from working.

    Flushing cache didn’t work, either….I love a mystery…

    Try activating Twenty Thirteen and rename archive.php to archive-breeding_projects.php. If that doesn’t work I would check here: http://codex.wordpress.org/Template_Hierarchy

    Keith –

    That helped. If i rename it taxonomy-{taxonomy}.php, it does the trick!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom Post Type Archive Page’ is closed to new replies.