• Hi all,

    I have a custom content type called Products which i have created a template for which lays out my products in a grid view.

    I have these products in different categories. I want the categories page to be exactly the same as my template page i have created but i can’t seem to do it.

    The category page seems to use the page.php template, i have tried a few different codes but can only seem to get it to display all of the products (in ever category) or no products.

    if anybody could help me with the code that would just grab the right products then i can do the rest. i have tried a basic `<?php while ( have_posts() ) : the_post(); ?>’ loop just trying to pull the title but that just stays empty??

    Any ideas?

    Thanks
    Dan

Viewing 4 replies - 1 through 4 (of 4 total)
  • You could query the category specifically by doing something like this:

    <?php $my_query = "cat=CATEGORYIDNUMBER&posts_per_page=-1"; $my_query = new WP_Query($my_query); ?>
    <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    WHATEVER YOU WANT TO DO TO EACH ITEM IN THE CATEGORY
    
    <?php endwhile; // end of one post ?>
    <?php endif; //end of loop ?>
    Thread Starter danhodkinson

    (@danhodkinson)

    The only trouble with that is I have about 20 different categories and so i wanted to avoid code that pointed to categories incase i add more and then i need to add more code.

    Dan

    Thread Starter danhodkinson

    (@danhodkinson)

    still haven’t figured this one out.

    Thread Starter danhodkinson

    (@danhodkinson)

    I’ve just come back to this but still can’t figure it out?
    Anybody have any suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Category Confusion’ is closed to new replies.