Support » Themes and Templates » custom post type archive-{posttype}.php wont load

  • I’ve got something that I just can’t figure out, hopefully this is an obvious thing that I’m just not noticing. I’ve got a custom post type that I created called “work”. I have those custom posts organized by categories, but when I click the link for the category in the meta on those custom posts it takes me to an archive page using the archive.php template. For some reason wordpress won’t load the archive-work.php template I have loaded. I know that it should look for that first, and its there, but it always loads archive.php. Single-work.php works great though. I’m kinda losing my mind here.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Anyone? Is there a trick to the template hierarchy I’m missing?

    This only works in WordPress 3.1, but I have downloaded 3.1 and it’s still not working for me. Anyone else?

    EDIT: Resolved: In 3.1 you need to include another parameter in order to enable the archive option (it is “false” by default)

    'has_archive' => true,

    Then refresh the rewrite (wp-admin – options – permalinks) and push the “save” button and voilá.

    Hope this help someone.


    It doesn’t work in 3.1 for me either.

    I have:
    – an archive.php file
    – an archive-producto.php (that is, for the “producto” custom post type)

    The custom post type is registered like this:

    $argproducto = array(
    	    'labels' => $lproducto,
    	    'public' => true,
    	    'publicly_queryable' => true,
    	    'show_ui' => true,
    	    'query_var' => true,
    		'rewrite' => array('slug' => 'productos'),
    	    'capability_type' => 'page',
    	    'hierarchical' => false,
    	    'menu_position' => null,
    	    'supports' => array('title','editor','custom-fields','thumbnail','excerpt','page-attributes')

    Where $lproducto are the labels.

    Notice there the rewrite is “productos”

    If I go to the site:

    It doesn’t work. But, if I try:

    It calls the index.php, not archive.php

    Yes, I tried to refresh the permalinks and nothing. Also tried to change the way that I was registering the custom post type (changing the hierarchical to false and making it post like) and didn’t work either.

    EDIT: BTW, This was a 3.0.5 version, I passed it to 3.1 via the automatic update.

    Any ideas?

    Try resaving the your permalink structure. Once I added the ‘has_archive’ => true
    & did that, the archive-{posttype}.php came up no problem in 3.1.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘custom post type archive-{posttype}.php wont load’ is closed to new replies.