Category Hacks for WordPress Theme Designers

One of the fundamental building blocks of the WordPress blog structure is the category. Of course the category serves as a way to organize the content and help visitors with navigation, but it also provides theme developers with opportunities to do some different things to make the theme a bit more distinct or more effective.

In this post we’ll take a look at a number of things you can do with WordPress coding that involve categories in one way or another. Hopefully this will be a helpful guide that you can refer to whenever you’re developing a new theme.

Looking for hosting? WPEngine offers secure managed WordPress hosting. You’ll get expert WordPress support, automatic backups, and caching for fast page loads. Visit WPEngine.

Exclude Specific Categories from Your Category List:

Most blogs include a list of categories in the sidebar to help visitors find the content that they want. However, there may be times when you want to exclude certain categories from the list. Fortunately it’s a very simple change.

This is the code to display all categories.

<?php wp_list_cats(); ?>

This is the code to exclude categories number 4 and 5 (you can get the category numbers in from the WP dashboard).

<?php wp_list_cats('exclude=4, 5'); ?>

Remove a Category from the RSS Feed:

You may also want to exclude posts in a specific category from being included in your RSS feed. Sideblogs are increasingly popular and usually you’ll want to exclude these posts from the main feed. Again, excluding categories is pretty easy. You could always use a plugin like Advanced Category Excluder (http://wordpress.org/extend/plugins/advanced-category-excluder/), or you could make the changes manually.

To exclude a category, use this URL for your feed:

http://example.com/feed?cat=-4

That would exclude category number 4. To exclude multiple categories, use a URL like this:

http://example.com/feed?cat=-3&cat=-4&cat=-5

Looking for hosting? WPEngine offers secure managed WordPress hosting. You’ll get expert WordPress support, automatic backups, and caching for fast page loads. Visit WPEngine.

Exclude Posts in a Category from Appearing on the Homepage:

There may be situations where you want to exclude posts from the front page based on their category. Often this will be in the same situations where you also want to exclude it from the feed.

To exclude a category from the loop on the front page, find this code:

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

and change it to this:

<?php query_posts('cat=-4'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

This will exclude posts in category number four from being displayed on the front page.

Show Links to the Most Recent Posts from a Specific Category in the Sidebar:

Many blogs use simple WordPress coding to show links to the most recent 5 or 10 posts in the  sidebar. You can adapt this to include or exclude specific categories.

To show the 10 most recent posts in category number 4, use this code:

<?phpquery_posts('cat=4&showposts=10'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>

To exclude category number for, simply put a minus sign (-) in front of the category number, like this:

<?phpquery_posts('cat=-4&showposts=10'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>

The code above will show the 10 most recent posts from all categories except number four. To exclude multiple categories simply add a comma, like this:

<?phpquery_posts('cat=-4,-5&showposts=10'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>

</ul>

Set Up a Separate Feed for a Category:

If you exclude a category from your main feed you may also want to offer a separate feed for the one excluded category (again, this is common for sideblogs). WordPress will easily give you the feed for any one category by using a URL like this one:

http://example.com/category/nameofyourcategory/feed/

If you want, you can take that URL and run it through FeedBurner and treat it like any other feed.

Show Post Excerpts on Category Pages:

To avoid duplicate content and to reduce the length or category pages, many bloggers choose to show excerpts instead of full posts. It’s a simple change. Find this code:

<?php the_content() ?>

And change it to this:

<?php the_excerpt() ?>

Show Only Post Titles on Category Pages:

Another option is to only show post titles. You can do that by using this code:

<?php the_title() ?>

Most likely your theme already has this code surrounded by a link to the permalink of the post. So what you will want to do is just delete the code that calls the excerpt or the content and leave the title and link intact.

Hopefully this post gave you some ideas that you can implement in your own themes.

If you like getting design inspiration by looking at excellent blog designs, you’ll love our new gallery site Blog Design Heroes.

Published September 14th, 2008 by

Looking for hosting? WPEngine offers secure managed WordPress hosting. You’ll get expert WordPress support, automatic backups, and caching for fast page loads. Visit WPEngine.

Join Our Newsletter!

Subscribe to our weekly newsletter chalked full of useful tips, techniques, and design goodies. We have 20,000+ loyal readers and counting! We’ll even send you a free e-book (Freelance Designer’s Guide to Multiple Income Streams) and a $10 discount on our most popular product the Freelance Starter Kit.

138 Responses

Comments are now closed on this post.

  • Mike Smith, September 14, 2008

    Nice breakdown of the category options for wordpress.

    Sidenote: Your blockquotes are stretching about 10 pixels inside your right sidebar.

  • Vandelay Design, September 14, 2008

    Mike,
    You’re fast. I thought I could fix the width before anyone saw it.

  • Mike Smith, September 14, 2008

    :) I just happen to open my reader to check for some articles for some design inspiration and saw your post.

  • NaldzGraphics, September 15, 2008

    thanks for sharing. is very useful

  • Nathan Beck, September 15, 2008

    Nice tut to read first thing in the morning. Further examples of how easy it is to fiddle and customise WordPress with little understanding of php.

    Thanks!

  • Dainis Graveris, September 15, 2008

    Nice tips, really took my interest for some time :)

  • JamieO, September 15, 2008

    Another thing people might want to check out regarding category template presentation is my Idealien Category Enhanceents plugin. It enables you to have the same capability of customization of templates and selection through the admin console for categories that you have for page templates.

    Instead of setting up a specific category-5.php you can specify a named title (category-photos.php) and then select which categories use that through the manage > categories panel. This also enables you to have custom post templates (single-photos.php).

  • Ryan, September 15, 2008

    Good list. I could have really used this a few months ago. I just wanted to mention (since I had to figure it out the hard way) that when you mess with query_posts(), as in the “Exclude Posts in a Category from Appearing on the Homepage” section, that “WordPress then ignores the other parameters it received via the URL (such as page number or category)”, so then the “previous/next page” links are broken.

    I wanted to include a possible fix here to save anyone else the headache. Just grab the ‘paged’ var, and add it to the call to query_posts() like so:

    <?php query_posts(“paged=$page&cat=-7″);

  • Ryan, September 15, 2008

    Whoa…seems like comments mangled my code. Should have had 2 lines:

    1.
    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    2.
    query_posts(“paged=$page&cat=-7″)

  • Vandelay Design, September 15, 2008

    Jamie,
    Thanks for sharing.

    Ryan,
    Thanks for the heads up and for providing the code.

  • Bryan, September 16, 2008

    What a great list of hacks. Categories are the biggest hassle and can get out of control after a blog reaches a certain point.

    Thanks for sharing.

  • Long Vit, September 26, 2008

    Could you please help with this?
    I have a multi-user WordPress blog. In writing and publishing a post, the user can choose more than one categories for one post to go in. How can I tweak it so the user can choose only one of the categories available for their level? In other words, when the user checks one category to post, other categories in the list (in the write post window) will be unchecked (kind of choosing only one correct answer in a survey). Please help. Thank you very much.

  • ems, October 7, 2008

    Hello

    In your “Show Only Post Titles on Category Pages:” when i tried to delete excerpt and the_content and only leave the title, it will display the number of posts i set in the settings of wordpress. What if I want to display 50 titles in that category but in my wordpress settings, i only display 5 posts in my home?

  • Vandelay Design, October 7, 2008

    ems,
    I believe if you use part of the code from the section above where I show how to display posts from a specific category in a certain location, there is a spot in that code that says show x number of posts. I think if you put that in the code you’ll be able to control how many are shown. I’m not in a spot where I can test it right now, but that’s what I would try.

  • Sugar Web Development, October 7, 2008

    You’re a life-saver, I’ve been looking for this for the last hour – how to exclude posts from a category. Its working well. Dave.

  • jcsot, October 12, 2008

    Thanks for showing how to create category feeds – one additional thing though… how does one make a feed that shows ALL the posts within that category. For the main feed I have set it to show 10 posts from the Settings page. But for the category feeds I want to show all the posts from that category.

  • Vandelay Design, October 12, 2008

    jcsot,
    I’m not sure if I understand your question or not. Are you talking about the feed as it will appear in an RSS reader? It sounds like you’re referring to the loop on a category page. This tutorial may help.

  • Monika, December 2, 2008

    wp_list_cats (Deprecated in 2.1)

    wp_list_cats is deprecated since WP 2.1

    please use wp_list_categories

    ;)

    Monika

  • Simon, January 6, 2009

    Hey!

    This was a great help. I was thinking that maybe you should incorporate Ryan’s hint, it saved me from an immense headache.

  • loren, January 10, 2009

    After two days looking for a way to display a list of posts filtering by category finally the solution. I’m not an expert but i guessed there would be a solution
    Thank you very much

    Just advise that there’s a missing space between php and query

    so the right code is:

    <a href=”">

  • loren, January 10, 2009

    i had problems with the code in top-header.php because affects the rest of the pages, works fine in sidebar.php
    :-?

  • Gary Jones, January 13, 2009

    Total newb to WP and struggling with the concepts. Maybe what I want to do simply isn’t possible, but I have to ask. I want certain categories and posts to only appear on certain pages. Is this in any way possible? I’m creating a business directory, so there will be hundreds of categories, posts and comments related to the specific section of the directory. To need to exclude these from other pages with be a major task. Thanks.

  • Vandely Design, January 13, 2009

    Hi Gary,
    Excluding categories is certainly possible, but I’m not sure I exactly understand what you’re asking. The term “pages” in WordPress lingo has a very specific meaning (i.e. a post is not a page), so I’m not sure I understand your situation. One thing I’ll definitely point out to you is the Advanced Category Excluder Plugin – http://wordpress.org/extend/plugins/advanced-category-excluder/

    This is the easiest way to control which categories of posts appear in certain places.

  • Gary Jones, January 13, 2009

    Maybe it’s just my lack of understanding of WordPress here. If I can give one example, my main page has a menu which has a business directory, with dropdown lists, for example, to Real Estate. This then drops down to links to, for example, For Sale, which is a page. I have a category setup for Real Estate – For Sale. I then want to post an entry for a listing, with a picture and allow users to comment or query this specific listing. It would be good to be able to also select the primary Real Estate category as well and have the post showup on the main index Real Estate page, with a thumbnail and a link to the specific detailed posting on the subpage.

    In the same manner I would like users to be able to post their own listings on my Classifieds section.

    I guess the gist of what I’m needing is that certain categories only show on certain pages. Does that make sense? Ideally I would like specific pages for each section, pages that would show different ads, video content and links. Impossible?

    Thanks.

  • Vandely Design, January 13, 2009

    Gary,
    By using parent and child categories you could get the results you’re mentioning in the Real Estate category. The WP search function is not very good out of the box. You may want to search for some info on customizations, but it’s not the best search functionality out there.

    Being able to post classifieds is a different situation. There are some themes created specifically for classifieds,, although the one that comes to mind first is no longer available because the developer seems to have disappeared.

  • donnie, January 21, 2009

    Thanks for the code/script :)
    useful

    Yours sincerely,
    donnie

  • Matt, January 28, 2009

    very helpful thanks!

  • Will, January 30, 2009

    Hi

    Thanks a lot, the article was really helpful.

    Good stuff, it was really helpful.

    Thanks again, I appreciate it, sharing!

  • dread, January 31, 2009

    nothing here that’s not already in the codex.

    • Vandelay Design, February 1, 2009

      Dread,
      Yes, I realize that. But sometimes the Codex is hard to use because there is so much info there. It can be helpful to have it broken down.

  • mick e, February 1, 2009

    Hey – thanks for this article – it is a good’n. and the fist tip worked great. However, I would like to relay my little glitch experience. (warning I am a relative WP noob)

    When I tried to do the “Exclude Posts in a Category from Appearing on the Homepage” on my site, the code somehow breaks the page chain, so when the user clicks on the “next” link (/?paged=2) it just redisplays the top posts again, and continues to do so after clicking again (/?paged=3) and so-on.

    FWIW, the theme I am using is “MassiveNews” a magazine style format.

    • Vandelay Design, February 1, 2009

      The fact that it’s a magazine theme probably has something to do with it. I recommend trying the advanced category excluder plugin if it’s not working the manual way.

  • mick e, February 2, 2009

    Well I tried the plug-in, and that introduced a whole new set of issues that I didn’t want to have, so I unplugged it and started over. I think there was a toxic cocktail of MassiveNews, EventCalendar and ACE going on. So I cranked up the iTunes and spent the evening sacrificing goats and waving chicken bones. Sometime around 1am I looked at the screen and everything was working.

    I wish I could tell you what I did, but it was all a blur. Bottom line, I was able to use your code to make it work. Thanks bunches.

  • Richard, February 10, 2009

    Very enlightening post… thank-you. Can you give a code for how to show a COMMENTS list (in a sidebar or page) only from specific categories? Been trying this and still can’t get it right on 2.7

    Thanks.

  • Eliott, February 11, 2009

    Hi there, nice tut and i was wondering if there is a small function to display only one category in the main page.

    I tried with many plugs but no one works ok.

    • Vandelay Design, February 11, 2009

      Eliott,
      Did you try the Advanced Category Excluder plugin?

  • Richard, February 12, 2009

    I have found this plugin http://wordpress.org/extend/plugins/post-lister/ that covers most options for displaying and selecting posts/comments from selected categories. I’ve tried it locally on 2.71 and it appears to work ok. Needs a little tweaking to get things right, but all the variables and functions are there. This works in a page/post as well as a widget.

  • albert, March 7, 2009

    Thanks for the code , but check the link example don’t work.

    “usefulhttp://example.com/category/nameofyourcategory/feed/”

  • João Dias, March 16, 2009

    Great Tut men, finaly i can have my category especific pages, and all thanks to you.

    As you can see, i coul get this to work in http://infpt.com, just choose “dicas” or “jogos” and you can see the pages working.

    I just had to copy the page template and add the css tags to this code.

    If you use it simple, it will show like a normal blog.

    The code i used was:

    <a href=”">

    <a href=”">Read More

  • JECCI, April 1, 2009

    “Exclude Posts in a Category from Appearing on the Homepage:” breaks all the links on the home page so we can use that… You should update your code.. and Ryan’s fix doesn’t seem to work either… I am still looking for a solution…

  • Vandelay Design, April 2, 2009

    JECCI,
    Sorry. That may be related to changes in newer versions of WordPress. I’ll look into it when I have the chance.

  • jason, April 4, 2009

    Hey thanks for the great tweaks.
    One i found the correct pages in my template, i was able to make the correct changes.

    I just love the Show Only Post Titles on Category Pages, its a great way to better organize categories so its more like a traditional non blog website.

    Your tips are truly gems.

    thanks again.

  • Wordpress Themes, April 4, 2009

    Excellent tips. WordPress is a great platform and to attempt to suit everyone would be a nightmare. Tips like these are what make WordPress such an excellent CMS. Easy to customize and many good folk devoting quality time and energy to all facets of the WordPress CMS.

  • mssmotorrd, May 3, 2009

    It’s the first time I commented here and I must say you share us genuine, and quality information for bloggers! Good job.
    p.s. You have a very good template for your blog. Where did you find it?

  • Great article, thank you for sharing !

  • jd, May 30, 2009

    Hi I hope you can help me with this category modify problem. I want the category to show just the titles – no content and I’ve tried deleting the code:

    <?php the_content(‘Continue Reading »’);>

    or replacing “content” with “title” but the content still shows.

    Here are first couple of lines of the “archive” page:

    <?php the_content(‘Continue Reading »’);>

    Any advice would be appreciated. Thanks in advance.
    jd

  • jd, May 30, 2009

    ok…the form is not allow me to post code..

  • Vandelay Design, May 30, 2009

    jd,
    The PHP code that says the_content is what is pulling the posts and displaying them. Try removing that code. You want to leave the code above it that calls the post title and the link.

  • begamo, June 1, 2009

    Nicely written, very easy to follow. Thanks.

  • Johnny, June 5, 2009

    Hi,

    At the bottom of every each post I got the link that go back the category. How do you remove it? Please help me out.
    Thank you all.

  • Vandelay Design, June 6, 2009

    Hi Johnny,
    Without seeing your theme’s code I can’t really say for sure, but if you look in the single.php file below the loop you should see some PHP code that pulls the category. If you remove that it should work.

  • Brainerd Realtor, June 15, 2009

    This is seriously one of the best posts I’ve ever read. You inspired me to clean up my categories and trust me, that wasn’t easy! This stuff is super important and it’s hard to find it all on one website/page like this. Thanks so much!

  • fikret, June 17, 2009

    does anyone know how can i control number of posts in archive page or category page?:S

  • Vandelay Design, June 17, 2009

    fikret,
    The Custom Post Limits Plugin is one easy way to control the number of posts on those pages.

  • fikret, June 17, 2009

    thx bro

  • webuildlink.com, June 22, 2009

    Thanks for your article. I need to know the current category id when a category is clicked , what functions/variable is available for finding the current category.

    I have found some code like $cat=get_query_val(‘cat’);
    but echo $cat is not showing anything.

    Please help

    Thanks in advance

  • jigolo, June 30, 2009

    very nice , great article thank you.

  • Website Design Services, July 7, 2009

    Another great article. It does show how easy it is to change WordPress to your liking. You don’t even need much knowledge of PHP.

  • Kino Creative, July 9, 2009

    Thanks for that, be aware though that using this code to exclude categories from the home page will break the navigation. After much searching I found the solution!

  • Dave, July 19, 2009

    Thank for the code. I will try it. Nice template

  • Iniara, July 21, 2009

    This code doesn’t work for me and I included the correct category id.

    I’m trying to follow Ryan’s fix for the exclude category in homepage but I can’t seem to make it work, maybe I copied it wrong or something. When I click to see the previous entries, I get the same ones from the first page.

  • auz1111, July 23, 2009

    Anyway to exclude categories fro mthe default WP calendar widget? I only want to show post dates from a specific category.

  • auz1111, July 23, 2009

    This would make my day if possible!

  • Dmitriy, July 30, 2009

    There is a new program that allows you to create and download WP themes directly from Photoshop (Divine plug-in). It will be interesting to both beginner and advansed users.

  • sms, September 24, 2009

    can you please post that how can we include specific tag pages in category list ?

  • Hardeep Singh, November 4, 2009

    Some of the readers faced the same problem as I did, related to removing categories from the category sidebar and calendar. Please refer to my blogpost here on how I fixed it:

    http://blog.hardeep.name/computer/20090228/hiding-wordpress-categories/

  • Vertical jump reviews, November 11, 2009

    Thanks for this awesome post. I needed to exclude certain categories from homepage and this worked really well

  • Billy, January 1, 2010

    Is there a way to Exclude Specific Categories from a single post? say for example this post is in two categories WORDPRESS and TWEAKS. but I want the WORDPRESS category excluded, so it would look like this. Published September 14th, 2008 in TWEAKS. Thanks In Advance

  • Kayle Simon, February 20, 2010

    Thanks for this. Is there a way to show the most recent posts from a set of categories in the front page excerpts? So the most recent posts from each of category A, B, C and D, for example?

  • Doug C., March 14, 2010

    Great article, but I can’t seem to get the “exclude” to work for some of my categories. I tried the ACE plugin and that didn’t do squat. So I deleted it and tried using your manual entries, and that doesn’t seem to work either. I’m wondering if I have to search for all the RSS URLs on my site and add them there, too. (???)

  • Doug C., March 15, 2010

    Is anyone home?

  • Vandelay Website Design, March 15, 2010

    Hi Doug,
    Sorry, but there are over 500 posts on the blog and this one is more than a year old. It’s not possible to answer every question that comes through. ACE should work but I’m not the developer of the plugin so I really can’t give any feedback there. I’m not sure exactly what you mean by this “I’m wondering if I have to search for all the RSS URLs on my site and add them there, too. (???)” Add them where? Are you trying to exclude categories from the RSS feed?

  • Doug C., March 15, 2010

    Sorry, forgive me. I’m just so exasperated with the issues going on with my theme. What I meant was that maybe I need to add your manual RSS fix to every instance of the RSS URLs on my site? I’m totally ignorant of this stuff so if this sounds dumb I apologize. The ACE plugin did nothing so I got rid of it. I am not sure where to enter your manual “exclude categories” code for the RSS URL. Is that on Feedburner or somewhere on my WP site?

    Thanks for replying :)

  • Doug C., March 15, 2010

    Well this is what I get for trying to do something I know nothing about, lol. I just had a friend help me with the issues I’m having (folio posts showing up in RSS feed instead of blog posts) and she told me to try the ACE plugin one more time. So I did – and it worked! Weird.

    I’m going to do a victory dance now………

    • Vandelay Website Design, March 15, 2010

      Doug,
      I’m glad you got it working with ACE. Honestly, that’s the easiest way to do it. Manual exclusions work, but if you’re not very familiar with WordPress it’s probably easier just to rely on an effective plugin.

  • Peter, June 27, 2010

    Category question for you.

    Is there a way to have a category blurb and picture in the sidebar for every different category?

    This would mean some kind of “if category is ‘travel’ then show the following html code on the category archive page of that category…”

    Thanks,

  • Prafulla, July 6, 2010

    My categories are not showing up in sidebar (though available in admin panel). I have upgraded now to WP 3 (replaced all files) – but still not showing. Then I replaced even the template – but the problem still persists.

    I have approx 20000 posts in my blog and approx 40 categories.

    I tried using plugins to show categories also – but same problem.

    What can be likely issue?

  • Povinné Ručení, July 7, 2010

    Hello, I am looking for plugin, who use car dealer. I need select category with Car Made, Car Model, Car year and next info. Can you help me with this and tell me how plugin I must use for this? Better ajax, thx.

  • Ram, August 12, 2010

    is there a way to control categories like typical PHP,

    say, i have 2 pages logo design and web design they are using sidebar to show categories

    i have a categories called business,music,art etc

    where in logo design page , when i click business category, it should show the result with logo designs alone.

    where in web design page when i click business it should show web designs related to that catgory.

    is it possible in wordpress?

    Please help ASAP.

    Thanks in Advance

  • DoubleM, August 31, 2010

    I’m trying add some static elements to each individual category page, so that readers will know a little about that page before reading the posts that show up there. Is there a way to do this?

    • Vandelay Website Design, August 31, 2010

      DoubleM,
      I believe you could use PHP includes for that, or another option would be to create page templates for the specific categories.

  • Thomas H, September 9, 2010

    Hi, and thanks for a great page.
    Is it possible to choose a specific category and have a full post feed for that unique post category only. While the main site setting is just show excerpts in feeds for the remaining categories?
    Or best of all create a new feed containing just any category, but with the option full post.

    If you ever heard of a plugin that can handle this or if possible to hand code this please let me know. :)
    Thanks.

  • Fort Collins Web Design, November 2, 2010

    “php query_posts(‘cat=-4′);” It just doesn’t get any easier than that. Perfect. thank you very much!.

  • MixMan, November 9, 2010

    Advanced category trivia :)

    Everything works great, but does anyone know a way to exclude posts from a specific category to show on the ‘previous post’ and ‘next post’ links, that are showing typically at the bottom of the single post page (or at the top, depending on theme)?

    Yes, I know, it’s a bit Star Trek shit, but anyway? :)

    • Vandelay Website Design, November 11, 2010

      MixMan,
      I’m not sure. I very rarely have ever used those previous/next post links.

  • Kvangelo, January 14, 2011

    Thanks a million !!!

    I’ve been searching all night for something like this. Almost threw my computer out the window :D

  • John McDuffie, January 21, 2011

    It’s much easier to, when dealing with categories, to include rather than exclude.

    This little bit of php will show only the categories you specify by ID.
    [code] [/code]
    Ok, granted, if you only need to exclude a few categories the exclude works perfectly, but in the event that you have say 20 categories and only want to display 5 – use include rather than exclude. The code is the same just swap the two words out.

    IMHO

  • Donato - Marketisoft.com, January 27, 2011

    There is a way to show only categories on the homepage? Each categories link will point to the list of posts for that category

  • Horia, February 10, 2011

    Dear John McDuffie,
    I didn’t understand where your PHP code dissapeared. I imagine that the following:

    “This little bit of php will show only the categories you specify by ID.
    [code] [/code] ”

    wasn’t meant like this. Could you please provide us again the php code?
    I would be very happy to use it, as I would need exactly what you said.
    Thanks a lot!
    Horia

  • Jaon, February 16, 2011

    Anyway to get the categories to show on the home page instead of the posts?

    • Vandelay Website Design, February 17, 2011

      Jaon,
      If you include the php code to show the category within the loop of index.php it will show up on the homepage. For example, if your homepage shows 10 excerpts you could have each excerpt indicate which category a post is in.

  • AJ Clarke, May 7, 2011

    Good stuff. I was looking for the one on how to remove a category from my feed. Works great, thanks!

  • shawn, May 12, 2011

    I’m in the process of building my blog and I have a question. I want 8 pages on my blog, can i put different categories on each page? example: if you were to click on the “TRUCKS” page..could i put the categories on the left side of the page as follows: 1. Engines
    2. Suspension
    3. Exhaust
    Now..if they click on the “DIRT BIKES” page, could they see only the following categories: 1. 2 cycle motors
    2. 4 cycle motors
    My blog has nothing to do with those subjects, i just used it as an example. The pages are listed below the header and the categories are listed on the left or right of the page? HELP!! Thanks, Shawn

    • Vandelay Website Design, May 12, 2011

      Hi Shawn,
      If I understand what you are trying to do, you can accomplish that by using different templates or by using PHP in the sidebar. It’s been a really long time since I have done this via PHP so I don’t have the code ready, but basically you can use PHP to say “if the post is in the trucks category, show the sub categories of trucks in the sidebar.” If “trucks” is a page and not a post you can use WordPress’s page templates feature to create a template specifically for that page that shows only the categories that you want in the sidebar. Then you can duplicate the process by creating templates for the other pages. If you’re new to WordPress and not sure how to do this you can probably hire someone to do it for relatively cheap. You could place a listing at http://www.elance.com or http://wphired.com.

  • shawn, May 12, 2011

    wow, thanks for the info, VERY helpful!!!!

  • shawn, May 13, 2011

    ok..i’ve made enough mistakes on my wordpress blog, time to start over from scratch. My friend knows how to do it and she’s going to do it for me. How do i delete everything and start over from scratch? I want her to be able to start from a clean slate

    • Vandelay Website Design, May 13, 2011

      Shawn,
      The easiest way is to access your server via cPanel, or whatever contol panel your host uses. You may need to go in and delete the database separately.

  • Sharon, September 10, 2011

    Hi!
    This is so helpful. I’m super new with PHP but already have a theme that another programmer coded for me, but is now done with the project and I just want to change what posts are displayed. I’m just wondering, where exactly with in the code would I post the code for: “Show Links to the Most Recent Posts from a Specific Category in the Sidebar:”?
    Within the Main Index template? Where in there?

    Thanks SO much!!

  • Daniel, September 13, 2011

    Do you have any idea how to exclude certain HTML from displaying only in certain categories.

    I.e. If i want a like button to only show up on a certain category or, a static image persay.

    Thanks! ;)

  • Debbie, November 15, 2011

    In what file do we make these changes? Thanks.

  • Nicole, July 19, 2012

    Hi there,

    I’m a newbie to blogging and am struggling with collapsing posts, etc. I have tried to understand what you have posted but it’s really quite beyond me.

    For example, firstly and most importantly, where do we find the code? On the Dashboard? That’s how lost I am.

    Would appreciate it if you could provide some advice and help.

    Thank you for your time in advance.

    Cheers,
    Nicole

    • Steven Snell, July 19, 2012

      Nicole,
      You can find your themes code in the editor (from WordPress dashboard go to Appearance > Editor). Or, you can any text/code editor and FTP.

  • Ramya, June 18, 2013

    Its really amazing and nice. Good share.