[wp-hackers] Custom post types and wp_get_archives

Mike Little wordpress at zed1.com
Tue Jul 3 21:22:58 UTC 2012

On 3 July 2012 21:10, Aero Maxx <aero.maxx.d at gmail.com> wrote:

>  Hi Mike,
> I have been trying to work out how to use the code that you wrote, as I
> like that it makes the recent posts widget work, but it seems to mess with
> my blog posts only page in that it shows posts from my custom post type
> aswell as posts from the blog, have tried using !is_page ( array ( 'Blog',
> 'blog' ) ) but it doesn't seem to change anything.
Sorry, I thought that was what you wanted. When you are talking about
archives, do you just mean the archives widget? I misunderstood your

Do you have any ideas as to what I could do ?
You need to remove the "cpt_add_to_posts" code.

> Also do you or anyone know how I could get a list based archive on my side
> bar for my custom post type, but to only show the last 6 months, as its
> fairly long list otherwise.
> Have decided to keep the blog posts and the custom post type archives
> seperate.

For your other issue, you will either have to use a plugin that will list
CPT archives, or write some code to duplicate the archives widget
functionality for your CPT, with the added functionality to restrict the
number of entries.

Mike Little

More information about the wp-hackers mailing list