WordPress.org

Ready to get started?Download WordPress

Forums

Index.php not working after adding loops (9 posts)

  1. mdo
    Member
    Posted 8 years ago #

    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?

  2. pcarlow
    Member
    Posted 8 years ago #

    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 } ?>

  3. mdo
    Member
    Posted 8 years ago #

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

  4. mdo
    Member
    Posted 8 years ago #

    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.

    Anyone?

  5. moshu
    Member
    Posted 8 years ago #

    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.

  6. mdo
    Member
    Posted 8 years ago #

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

    Thank you so much.

    :)

  7. mdo
    Member
    Posted 8 years ago #

    One more quick question:

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

  8. moshu
    Member
    Posted 8 years ago #

    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?

  9. mdo
    Member
    Posted 8 years ago #

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

    Thanks for the help though!

Topic Closed

This topic has been closed to new replies.

About this Topic