• Yet another problem with custom post types.

    When you click on an archive link (say December 2010) it will only use archive.php to display the posts if that month includes one of ‘post’ type. If if does not and only includes custom post types, it will use index.php to show the posts.

    How do I stop this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter minklet

    (@minklet)

    For example:

    December 2010 contains 2 custom post types and one normal post,
    http://nottingham.subverb.net/blog/toast/2010/12/

    and September only contains a custom post type
    http://nottingham.subverb.net/blog/toast/2010/09/

    As you can see, it is using a different template to display the archives.

    I DO NOT WANT A SEPERATE ARCHIVE FOR EACH POST TYPE. I have done that already, I want archive.php to include all post types.

    I have already added this, in the exact same manner as the index.php
    <?php global $wp_query;
    $p = array(‘post_type’ => array(‘event’,’post’, ‘photos’, ‘audio’));
    $post = array_merge($wp_query->query_vars, $p);
    query_posts($post); ?>

    I know this board is largely pointless and no one actually gets any replies, but can someone help me here please? Custom Post Types are driving me insane, I swear they should havent been released yet, they clearly arent finished.

    Thread Starter minklet

    (@minklet)

    ….anyone?

    Well, CPTs were designed to operate outside the flow of posts. I believe it is intentional that they do not come up for archive pages.

    Hell, if they did I wouldn’t be able to use them properly, as I want CPTs outside of my normal stuff.

    Now I can’t directly answer your question, but WP 3.1 release notes mention of inclusion of CPT archives.

    I don’t know a lot about it, but take maybe a look into it will help you see if its going to do what you need

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘archive.php not used for custom post types’ is closed to new replies.