Support » Fixing WordPress » Getting 1 Category of Posts on Index

  • Everything was working.

    I was using

    if (empty($cat)) {
    $cat = '1';

    on the top of my index page. Only those posts from category 1 are showing up. But when I click on other categories, the posts from category 1 are showing up on other pages -example: in category 2.

    If anyone knows what happened or can give me some direction, it would be appreciated.


Viewing 6 replies - 1 through 6 (of 6 total)
  • did you ever find an answer to this? i have the same need…?

    The following alternative may work

    if ( empty( $_SERVER['QUERY_STRING'] ) ) {
    $cat = "1";

    this seems to work for me:

    <?php if (empty($_GET[‘cat’])) $cat=”1″; ?>

    darrellberry, that works if one doesn’t link to archives, or authors’ posts, or anything other than category pages. The one alphaoide points out makes sure no query-string exists, the case for the home page (under most circumstances).

    Thanks alphaoide,

    That worked.


    Oke, this is not working on my current testblog (wp1.5):

    if (empty($_SERVER['QUERY_STRING'] ) ) {
    $cat = "2";

    <?php include "header.php"; ?>

    It still shows ALL categories.

    I tried to find Kittens ‘show-categories’ plugin – but her site is down at the moment and the plugin directory doesn’t show anything either.

    I also tried the mini plugin from here:

    But it tricks WP into showing the ARCHIVE page of one category – instead if the index page. Since I have conditions in my theme either for index or archive this is not helpful either.

    Any insights greatly appreciated. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Getting 1 Category of Posts on Index’ is closed to new replies.