WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Need help with conditional statement in page.php

[Resolved] Need help with conditional statement in page.php

  • I want to display the page name on pages other than the Home page. As a beginning test with page.php, I put this code in place of the line that displays the page name. This code is supposed to display a string of x’s on the Home page only. It doesn’t display the x’s on any page. I’m new to php syntax.

    <?php if (is_home()) { ?>
    xxxxxxxxxxxxxxxxxx
    <?php } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • According to Conditional_Tags, is_home returns true when the main blog page (usually displayed by index.php) is being displayed. Your page.php would not qualify as true.

    >Your page.php would not qualify as true.<

    That’s certainly true but I still don’t get why.

    Anyway, this worked:

    is_page(‘Home’)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Need help with conditional statement in page.php’ is closed to new replies.
Skip to toolbar