WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Date based Custom Post Type Archives (5 posts)

  1. fonglh
    Member
    Posted 3 years ago #

    Hi,

    I'm using a child theme of twentyten. example.com/cpt/ redirects to archive-cpt.php as expected, but example.com/cpt/2011/02 goes straight to the 404 page.

    As far as I know, it was working just yesterday and I haven't changed anything. It looks like the permalinks stopped working properly as printing the query array on the 404 page gives Array ( [page] => /02 [cpt] => 2011 [post_type] => cpt [name] => 2011 )

    How can I force it to write the correct query like it does for built in posts?

    I've already tried refreshing the permalink settings but the problem still persists.

  2. fonglh
    Member
    Posted 3 years ago #

    I've figured it out. Rewrite rules have to be added. I modified the code from the Custom Post Types plugin.

    I think what happened was that I didn't refresh the permalinks when I deactivated the plugin and just assumed everything was working. So when I refreshed them again they all got lost.

  3. Aaron Wagner
    Member
    Posted 3 years ago #

    Can you enlighten me on how you accomplished this? I would like to do something similar. Specifically the rewrite rules that you used?

  4. fonglh
    Member
    Posted 3 years ago #

    I have a series of blog posts about it. It's not meant to be a tutorial, instead it's a record of what I tried to get it working. The first post is at the link below.

    http://wpadventures.wordpress.com/2011/02/13/custom-post-type-archives/

  5. Seebz
    Member
    Posted 2 years ago #

    I have made a little PHP class that register CPT with support of archives by dates.

    You can found it there : WP Custom Post Type with archives per dates

Topic Closed

This topic has been closed to new replies.

About this Topic