Support » Fixing WordPress » “How To” Present Single Category on Separate Page?

  • At,
    there are instructions on how to EXCLUDE a category from display on the main page.

    But what I’d like to know is the COROLLARY to this: How to display that single category exclusively on a DIFFERENT page.

    For instance: Suppose I have five categories, that we’ll call #1-#5. Suppose further, that I want to EXCLUDE #3 from the main blog page. That’s apparently covered in the Codex entry noted.

    But suppose, still further, that I then WANT to display #3 on a DIFFERENT page altogether.

    How would I do that?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Well, I’m no code wizard, but the common sense solution to me seems to be to exclude categories 1,2,4, and 5 from the loop on the category 3 page

    I agree, that makes sense, but I’m not enough of a PHP codie to understand how to “and” these together. Any more specific info would be much appreciated.

    No further replies?!?!?

    I would exclude category 3 from the index.php loop, and then link to the category’s archive page from somewhere on the main page. You can set up a template page called category-3.php in order to have the category page display the same stuff as the index instead of defaulting to the archive template, as well. That way you don’t need to bother with excluding all the other categories, and you get a page for just that category.

    Thanks, that makes sense at least in a theoretical way, but of course I’m battling extreme n00bness, here. If I understand you, you’re saying “map the ARCHIVES of the category you want to display instead of ‘the_posts'” (at least that’s what I think I’m reading).

    But can you point me to an example of this?


    Two possible solutions (both are on that page, near the bottom):
    1. Use <?php if ( !(in_category('3') && is_home()) ) { ?> as on the codex page. This will hide cat 3 only on the home page. If you then link to cat 3 (instead of cat3.php), only cat 3 will display (using index.php).
    2. Use <?php if ( !(in_category('3')) ) { ?> on index.php and <?php if ( in_category('3')) { ?> on cat3.php.

    If you don’t like IanD’s answer, and want to use the category archive:

    – Exclude category 3 from the index: <?php if ( !in_category('3')) { ?>
    - Create a link to category 3 wherever it is that you want the link. One possibility is to use list_cats()
    - Create a template file name
    category-3.php, and in that file use the same page layout template that you have on your index, minus any main-page specific code (like the excluding if statement)

    If I had my site fully converted to WordPress, I'd toss you a link for an example, but it's not up and running completely yet.

    Ack, forgot to cose a code tag, sorry about that. I’d edit it if I could.

    Okay, we’re rolling now. As of now, I have the ability to have any post submitted to that one particular category show up ONLY on the unique page assigned to it, and PERFECTLY in sync with the format on that page. (For reference purposes my “News” page is found at

    One of the most important things I’ve discoverd (“DUH!”) is that you must have the .php extension on the file. I presume Apache (in my case) has to have this to know to invoke the PHP module. Others can fill us in on that far better than I can.

    Also, I’ve hacked the “loop” portion of the code so that it shows only the title (with no permalink, since I just want to put my news items up and don’t need the “comments” feature).

    What I need to do now (further hacking required) is (1) have it show the posts only from the current month (but ALL those from the current month) on the “live” page but one the option of going back to prior months; (2) an option for “(1)” so that would allow me to have a list of links in the “sidebar” area showing titles of older articles–this option might work with having, say, ten “full” articles in the mainbar and all the others in the sidebar–maybe all the articles YTD.

    Any recommendations along these lines would be very welcome.


    Wouild you please mind sharing your code snippet on how you got this working?
    Thanks in advance.

    I used this thread to set up a WP site showing only category 1 on front page, and linking to other categories. But now, after upgrading to WP 2.0.3. Anybody know anything about this??

    Can someone exclusively post a howto about this? Since I have no clue about php and coding, the solutions given were simply incomprehensible. Just to make my problem clear : I have a particular category, say, Ramblings, I want that to appear on the main page. I have another category called ‘Coding’, which I want to be on the ‘Coding’ page. How do I go about it? Where do I add code and what code do I add? Any help in this matter is duly appriciated and thanked for.

    Well, if you couldn’t understand from the above and from the links in the Codex – give it up.

    Even writing down once again what was said wouldn’t help.

    Just go and use a plugin:

    RYO ‘Category Visibility’ WordPress Plugin

    Hey, is there a way where I use the plugin execPHP, Create a new page called Category 1, and write code on that page which calls for the posts in Category1? And remove the Category1 from the category list in the siderbar??

    1. The most common misconception. You do NOT need any Page to display posts in a catgeory. You need a Category Template.
    Mandatory reading:
    2. For removing from the sidebar look up the parameters of the template tag used in your sidebar:
    (hint: look for “exclude”)
    3. Why would you need phpexe? I don’t get it.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘“How To” Present Single Category on Separate Page?’ is closed to new replies.