• Resolved hilj

    (@hilj)


    I’m trying to show news in a sidebar on homepage.

    (the whole thing is in pastebin.)

    As soon as I ad this… (on line 11)

    <?php if (is_page('4'))
    		{
    		get_sidebar();
    		} ?>

    …to get the sidebar, then the page content is not showing at all. I have two posts in the sidebar and they show where the Page content should be. The sidebar if fine though, but where’s the Page content?

    The first “if” on line 3 has no effect to this, I tried to remove it and same happens.

    Hope someone can help, thank you so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have two posts in the sidebar

    That’s the problem: the Loop used in your sidebar over-writes the original Loop in the Page template.
    Read the Codex about the use of multiple Loops

    Thread Starter hilj

    (@hilj)

    I just added… `<?php query_posts(); ?> …before the loop in page.php and it works. Is that proper way to it?

    This was very nice, thank you for you help!

    Thread Starter hilj

    (@hilj)

    Hmm… Now the page 4 content displays on every page. Didn’t work. Any ideas?

    Thanks!

    Read that article again. No, you didn’t do it in the proper way.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘“if” statement is messing my page.php somehow?’ is closed to new replies.