Custom Post Type Archives
-
This one had me scratching my head a good long while, so, I thought I would post it here for anyone else who might find themselves stumped.
I’ve been using WP-dTree in some form or another on a particular site to list an event archive in a sidebar. Several years back I migrated those events to their own custom post type and as I only use the one archive, did a Q&D change to the wp-dtree-arc file to switch post_type to “my post type”.
This has worked without fail for years, but, at some point in the not too distant past a combo of upgrades rendered my alterations moot and the archive was showing regular posts, even though the code clearly said to do otherwise.
After much head scratching and bewilderment, I finally notice the cache function that is now in the code due to some global issues Ulfben said he was having … so, as I use the function, not a widget, I disabled the cache and of course my custom post types reappeared. I had previously attempted to do the same by flushing the cache with permalinks, but, that didn’t have any effect. I also thought that once the caching was disabled that perhaps I could reenable it and all would be good, but, not the case. It had to stay permanently disabled in order to pull in my custom post types for the correct archive.
I don’t know if you can use this info Ulfben, but, let me know if can and you’d like to take a look at this on my site to see it in action~
I use the following call to bring in my custom post type tree now …
if(function_exists('wpdt_list_archives')){ wpdt_list_archives('treetype=arc&type=yearly&showcount=0&cache=0'); }
- The topic ‘Custom Post Type Archives’ is closed to new replies.