[wp-hackers] Archive Widget for Custom Post Types?

Anca Mosoiu anca at anca.tv
Wed Dec 22 21:50:40 UTC 2010


Hello everyone,

I'm trying to create a widget that provides the same archives functionality as the one included with basic WordPress, but lets the user choose which post type archive to display.  

I looked around in the default-widgets.php file for how the archive widget is built, and it looks to use the function "wp_get_archives", which applies the "getarchives_where" filter and returns a list of archives by date.

As per track #13462 (http://core.trac.wordpress.org/ticket/13462) we are supposed to use this filter to achieve the result of listing the archives for custom post types, but I'm trying to figure out how to make this work only when this code is being called from within my widget.

Do I register the filter in my widget class file?  Or is there something else I'm missing?

Thanks,

Anca.









More information about the wp-hackers mailing list