Repeating Categories (2 posts)

  1. jazfotodesign
    Posted 5 years ago #

    you can see the last 3 are duplicates


    <?php $getcats = get_categories('hierarchical=0&hide_empty=0&include=' . get_inc_categories("woo_cat_mid_")); ?>
    <?php foreach ( $getcats as $cat ) { ?>
    <?php query_posts("cat=".$cat->cat_ID."&showposts=" . get_option('woo_cat_list') ); if (have_posts()) : ?>
    								<?php while (have_posts()) : the_post(); $count++; ?>
    <div class="post">
    <h5 class="pink-links uppercase"><?php the_category(' ') ?></h5>
    								<h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
    								<?php if ( get_option('woo_content_mid') == 'true' ) { the_content(); } else { the_excerpt(); } ?>
    								<?php endif; ?>
    <?php } ?>
  2. Michael
    Forum Moderator
    Posted 5 years ago #

    using the query parameter ("cat=".$cat->cat_ID will include posts with child categories of the Ccat->ID;

    Show One Category by ID

    Display posts from only one category ID (and any children of that category):


    from: http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters

    if you want to avoid this, use

    Show One Category by Name

    Display posts from only one category by name:

    query_posts('category_name=Staff Home');

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.