Support » Fixing WordPress » Index.php not working after adding loops

  • On a site of mine, I added some loops to various pages – one custom loop per page to show only posts from one category.

    Now instead of the front page showing all the posts, as it normally should, it is showing part of posts from a particular category.

    How can I modify the loop on the front page to show all the posts, as it normally would?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I would try this:

    <?php if (is_home()) { ?>
    Do this if it’s the home page.
    <?php }else{ ?>
    Do this if it’s any other page.
    <?php } ?>

    Would that work though if I have about 5 loops, each for a specific page?

    Can anyone please help?

    I am in need of some explanation to using different queries on individual pages.

    Somehow they have messed up the query for the main page.


    If you stop mentioning “pages” – somebody might be able to help 🙂
    Pages have a special meaning (unfortunately!) in WP, and displaying posts on Pages is a nonsense… so people just skip your post here.

    For displaying post from one category. That’s done automatically by WP when you click on a category name in the menu/sidebar.
    Now if you want to “style” those listings differently, read about: Template_Hierarchy and Category_Templates.

    I think I love you moshu. (not really though)

    Thank you so much.


    One more quick question:

    Why is it that my the Main Index Template still doesn’t display all posts that I have made?

    What exactly does NOT display?
    Is there a “system” in what is not displaying?
    I mean: you have 33 posts and it displays only 6. See admin > Options > Reading.
    Or, it doesn’t display posts from certain category/categories? – Maybe you have a modified Loop in the index.php file.
    So, what’s happening?

    I think I fixed the problem, which lay in some bad PHP. It is fine now.

    Thanks for the help though!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Index.php not working after adding loops’ is closed to new replies.