oldbag66
Member
Posted 3 years ago #
hi, im making my own dynamic sidebar and i just want to exclude a category from this script, any help would be appreciated:
<div class="widget">
<?php query_posts('showposts=10'); ?>
<li>
<h3>Latest News</h3>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href='<?php the_permalink() ?>'><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</li>
</div>
The template tag, query_posts(), has a cat=-7 argument. Replace the 7 with your category ID.
oldbag66
Member
Posted 3 years ago #
ok that makes sense, i actually need to exclude it from this code (sorry my mistake) and not sure how to add the cat exclusion
<?php wp_list_categories('show_count=1&title_li=<h3>News Categories</h3>'); ?>
i tried this but it doesnt work, am i close!:
<?php wp_list_categories('cat=-13&show_count=1&title_li=<h3>News Categories</h3>'); ?>
The template tag, wp_list_categories(), uses an exclude= argument (with NO minus sign).
<?php wp_list_categories('exclude=13&show_count=1&title_li=<h3>News Categories</h3>'); ?>
oldbag66
Member
Posted 3 years ago #
thats great thank-you very much.