WordPress.org

Ready to get started?Download WordPress

Forums

Repeating Categories (2 posts)

  1. jazfotodesign
    Member
    Posted 3 years ago #

    you can see the last 3 are duplicates

    http://www.spiritgrowth.com/?page_id=203

    <?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(); } ?>
    								</div>
    								<?php endif; ?>
    
    <?php } ?>
  2. alchymyth
    Forum Moderator
    Posted 3 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):

    query_posts('cat=4');

    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

Tags

No tags yet.