I bet at least some of you have noticed that when you click on a category that includes only DukaPress products, you often get a 404 error page. This happens because most WordPress themes do not include custom post types (which DukaPress uses) in category, index, and even archive pages.
The good news is that this functionality is begin built into WordPress and has just been “committed” – meaning that it will probably be included int he next release of WordPress.
Nice, eh? Now you don’t have to write custom category templates for each product category.
HI, i’m Gabriele from italy, i have found a Tricks for the category page.
If you install a little plugin called “Category Based Archives”.
Now you you can find the ID category.
In the category.php put this code (NO LOOP)
Finish
I use category-1.php for the blog post.
Bye Gabriele 😉
Thanks for this! 😀
Hi,
This may be easy, but I am stumped. I need to know the category number in order to set up a products page that will display the appropriate categories, but there is no easy way to tell what the number is for any given category. I have been able to do it by trial and error. but it slow and ridiculous. Is there an easy way to look at a category, such as “Christmas” and know what the corresponding code is?
Thanks
Unfortunately, there’s no easy way. But there’s a way that is better than trial and error. Here it is: http://thumbpress.com/how-to-find-category-id-in-wordpress
Link is now 404. Anyone have this laying around???
Try this: http://www.wprecipes.com/how-to-find-wordpress-category-id 🙂
I am not sure if the deployment in WordPress you mentioned above has been included yet. I have been having this problem too and did some digging.
It seems to be a common problem and can be resolved by a simple copy and paste into your template’s functions.php file through the Editor in the Admin Pages.
This link covers the details :
http://wordpress.org/support/topic/custom-post-type-tagscategories-archive-page
I pasted this code into my Functions page :
add_filter(‘pre_get_posts’, ‘query_post_type’);
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var(‘post_type’);
if($post_type)
$post_type = $post_type;
else
$post_type = array(‘post’,’duka’); // replace cpt to your custom post type set(‘post_type’,$post_type);
return $query;
}
}
Keep up the good work Duka Team!
Thank you for this!
I’m curious if it’s possible to add text to category pages? I’d like to have an opening paragraph at the top of the page but once the dpsc_grid_display is in place, the page only shows the grid and nothing else.
Any advice?
Really? This page has other content: http://dukapress.org/demo/
Please let me see your site to see if I can help further.