Support » How-To and Troubleshooting » [Resolved] Modifying the front page

[Resolved] Modifying the front page

  • I want to modify the front page of my WP installation so that it only displays posts from certain categories. Is there an easy way to do this, or do I have to mess with PHP? If I have to mess with PHP, which file controls the front page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I would suggest reading up on “The Loop” in the Codex. Basically, your front page is controlled by the index.php. This file will have a loop in it which esentially loops through your database and displays the posts.

    While I’m not a php expert (really more a novice), I’m sure there is some form of conditional logic that could be used in this loop to only display posts in certian categories. I’ll let someone with more php knowledge jump in here.

    Good luck!

    Or… after I did a bit of searching found that Moshu recommended this plugin for another person that does what you want, I think.


    I read up on the loop thing (I actually did that before posting this question), and fixed the problem using one line of PHP code. I just wanted to know if there was an easier way, since the way I did it isn’t very clean (I have to manually keep track of the category IDs, should they ever change).

    Here’s my code, placed after the start of “The Loop”:

    <?php if (!in_category(‘4’) && is_home()) continue; ?>

    If there’s a better way of doing that, like, say, making sure it’s still valid, even if the category ID would change (I’d rather it keeps track of it using the name of the category), I’d like to know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Modifying the front page’ is closed to new replies.