WordPress.org

Ready to get started?Download WordPress

Forums

How to keep only one category on the index page? (8 posts)

  1. Anonymous
    Unregistered
    Posted 9 years ago #

    Just installed WP and liking it a lot. I've been trying to figure out one thing though and I am stumped. I want to use categories for navigation. I've removed the categories from the meta and have replaced them with navigation links which is working fine, thanks to list-o-matic.
    I would now like to have a generic welcome index.php page, from where the visitor can browse the categories but try as I might WP insists in publishing all cats on index.php. Or am I missing something insanely obvious. Which HAS happened before :)

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Try a search for 'show one category' here.
    You may need to make a 'welcome' category for it to show though.

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    Many thanks.
    This works for me:
    <?php
    $blog = 1;
    $cat="1";
    /* Don't remove this line. */
    require('./wp-blog-header.php');
    ?>

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    Actually, scratch that. Not working at all, it now displays the same intro post that I only want to appear on index.php in each category and hides everything else, regardless of the category the post is tagged as. Grrrr. Serves me right for trying to make WP make things it obviously wasn't designed to do :)
    Onwards and upwards.

  5. joand
    Member
    Posted 9 years ago #

    Instead of $cat="1" put:
    if (!isset($cat)) {
    $cat = "1";
    }

    Which I THINK means "if no category is selected, show category 1" rather than just "show category 1" which would override whatever category was acturally selected.
    I finally got this to work after much head bashing (with help here!) and looking at outdated info.
    Joan

  6. joand
    Member
    Posted 9 years ago #

    Getting it to work I got the help with I meant - not the head bashing!!
    Joan

  7. Anonymous
    Unregistered
    Posted 9 years ago #

    Joan, you are my HERO. Thank you so much.
    This works. Maybe something to add to the next version? This takes WP from 'just' a blogging solution to a full blown CMS.
    Thanks again, I shall get going.

  8. Anonymous
    Unregistered
    Posted 9 years ago #

    Nice advice, thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.