0

I'm trying to create an archive for a custom post type. My custom post type is called journal and I'm running WordPress 3.3.1. My understanding is that from WordPress 3.1 this should be an included feature so navigating to www.mywebsite.com/journal/2013 should simply return a collection of posts from 2013 using the archive-journal.php template. My issue is this doesn't work. I have posts from 2013 but going to that link simply returns a 404.

www.mywebsite.com/journal/ works fine but trying to add any date filter to the end of the url with cause 404s. This is the code I'm using to register the post type. I haven't included the $labels array in below but it's in my functions.php

    $journal_args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array('slug' => 'journal', 'with_front' => true),
    'has_archive' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','editor','thumbnail', 'comments'),
  ); 

register_post_type( 'journal' , $journal_args );

Have I missed anything? Has anyone got any idea why the date archives are not working?

  • Do you have update the permalink settings after activation on your code in WP? It is important, that you flush the rewrite rules. – bueltge Jan 2 '14 at 11:55
  • yep tried flushing the rewrite rules didn't make any difference – Scott w Jan 2 '14 at 12:11
  • If I have a custom post type named 'my_type', how can I get Wordpress to make date-based archives, for example: mysite.com/my_type/2010/ mysite.com/my_type/2010/07/ mysite.com/my_type/2010/07/28/ – user44599 Jan 2 '14 at 12:25
0

After some more searching I found this. If you register your custom post type using the function as described in the link it will add an additional date archive.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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