Support » Fixing WordPress » index.php display only one category?

  • I tried searching, but I think I might have flubbed the terms. But I’m sure this is answered, and obvious. Since visitors reach my site, and it loads index.php, I want it to only show one category by default. Not the last XX posts from all categories, but just the last XX posts from the category of “mainpage.” I know I can do this by passing parameters on the URL line, but is there I can set a setting, or do it just whenever someone loads up index.php by default?
    Thanks.
    .tfn

Viewing 7 replies - 1 through 7 (of 7 total)
  • Open index.php…. find the line that reads:
    $blog = 1;
    Add this line right after it:
    $cat = ‘X’;
    Where X is the category number you want to show.
    TG

    Thread Starter theflyingnut

    (@theflyingnut)

    Hrm.
    The first reply does seem to work. But that locks me into only showing one category, no matter what.
    The second option looks like it what.. (I’m a total PHP weenie here..) it only shows the category of “X” based on is the URL is a certain structure/type? It doesn’t seem to work, since I want visitors to only see category “2” when they load mysite.com/wordp/ or mysite.com/wordp/index.php
    Am I missing something really obvious?
    Need further info?

    No you aren’t missing anything and it isn’t because you are a php newbie either. This question has been left unanswered since I started using WP months ago so don’t feel bad–there are a lot of php proficient people on here and the question is still left open without resolve.
    Ironically, I’ve been using the empty condition “if ($cat == ”) $cat = 2;” for some time now before realizing that it isn’t really excluding the other categories. It just so happens that the main page addition was my last post. Once I added a new category the next post started showing on the front page and I realized I was, again, back to square one. QUITE frustrating!
    My site uses multiple installs–the main index consisting of stagnant pages/categories with links to the specific categories and the blog formatted categories are separate installs.
    For the time being, every time I add a new category I have to delete the “News and Updates” category that appears on the front page and repost it after adding the additional category.

    Couldn’t someone provide a solution in the CVS whereby just adding a parameter to the WP motor start filter out certain catagories? That would be the ultimate solution couldn’t it?
    Also, is there anyway to include another WP motor onto a single page? Tried it and it doesn’t work. Any workarounds BESIDES needing to install a seperate WP?

    @hsl,
    Uh, not sure what is left unanswered. Did you not see allusion’s link to the Wiki? Perhaps you are actually thinking of something different than what Matt posted on the Wiki?
    Here is the link that Matt posted earlier in this thread.

    @zaaba,
    May I suggest you post your suggestion to the Requests and Feedback section of the forums so that it doesn’t get lost in this thread?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘index.php display only one category?’ is closed to new replies.