Exclude category from category archive

I’ve included the code I’m working with below. I had some custom work done on a wordpress site of mine. This is a page that shows an list of the categories along with images and a short description. I’m not quite sure how to go about exclude a single category from showing up on this page.

This is a media site, so all of the categories correspond to productions. I’d like to create a blog, but am unable to until I can find a way to exclude the category from showing up on our production page. Any help would be appreciated, can typically work my way through WP, this one has me stumped at the moment.

<?php include( TEMPLATEPATH . '/admin/admin-init.php' ); ?>
    <div id="main">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <div class="post" id="post-<?php the_ID(); ?>">
            <h2><?php the_title(); ?></h2>
            <div class="post-content">
                <?php the_content(); ?>
            </div>

    <?php endwhile; endif; ?>

            <div class="divider"></div>

            <div class="image-gallery categories-archive">  

                <?php

                $categories = get_categories('hide_empty=0');
                $imgs = get_option('ciii_image_names');
                $upl = wp_upload_dir();

                foreach ($categories as $c): ?>
                    <?php
                    $img = isset($imgs[$c->term_id]) ? $upl['baseurl'].'/category-images-ii/'.$imgs[$c->term_id]['original'] : $upl['baseurl'].'/dummy-285x175.png';
                    ?>

                    <div class="one_third">
                        <div class="post-img-medium">
                            <a href="https://wordpress.stackexchange.com/questions/53005/<?php echo get_category_link($c->term_id) ?>" rel="bookmark" title="<?php echo $c->cat_name ?>"><img src="<?php echo $img ?>" width="285" /></a>
                        </div>
                        <h2 class="post-title"><a href="https://wordpress.stackexchange.com/questions/53005/<?php echo get_category_link($c->term_id) ?>" rel="bookmark" title="<?php echo $c->cat_name ?>"><?php echo $c->cat_name ?></a></h2>
                        <p><?php echo $c->description ?></p>
                    </div>
                <?php endforeach; ?>
                <div class="clear"></div>

            </div>

        </div><!--post-->

    </div><!--main-->

3 Answers
3

If everything else is doing what you want, change this line:

$categories = get_categories('hide_empty=0');

To this:

$categories = get_categories('hide_empty=0&exclude=10');

Swap ’10’ with the category number you want to exclude.

Leave a Comment