• Hello,

    I am using WP 3.1 and having issues with archives.

    I know wp_get_archives does the trick, but how to do it for post types other than ‘post’ types (usual ones) ?

    Also, how to get the template working for e.g. https://www.example.com/movies/2011/02 ? (if custom post types are ‘movies’)

Viewing 6 replies - 1 through 6 (of 6 total)
  • fonglh

    (@fonglh)

    I had to do this for a website I’m working on and wrote about it in a blog post.

    Basically you have to add ‘has-archives=>true’ to register_post_type() and add a filter to getarchives_where.

    If you want a custom template, name it archive-movies.php

    Thread Starter Marko Jakic

    (@markzero)

    Thanks for the info, it helped getting the archives list, by month!

    But template is just not working.. I have the file but it redirects to home page..

    Any clue?

    fonglh

    (@fonglh)

    oh oops the right key is ‘has_archive’.

    Strangely it has stopped working for me although it worked yesterday and nothing has changed. I’m trying to figure out which template file it gets directed to.

    The template thing works for me, but fails as soon as I add the year and month. So example.com/movies goes to archive-movies.php, but I have no idea where example.com/movies/2011/02 is ending up. It doesn’t find anything even though the posts are there.

    I’m having the exact same problem, @fonglh – please say you did solve this? I’m not even getting the cpt home page, I get straight to the 404 page.

    Check out the series of blog posts I linked to in the first reply. I’m not really sure why it works, so I just summarized what I did and didn’t touch it anymore.

    Ok cool, thanks for your reply. I’ll check it out asap.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to archive monthly or yearly custom post types?’ is closed to new replies.