DukaPress Category & Archive Pages

10

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.

10 Responses

  1. 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 πŸ˜‰

  2. Darby says:

    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

  3. Steve says:

    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!

  4. Rick says:

    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?

Leave a Reply

© 2016 DukaPress. All rights reserved.
Design By Madoido.