WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need help with conditional statement in page.php (3 posts)

  1. mwrmwr
    Member
    Posted 5 years ago #

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

  2. MichaelH
    Member
    Posted 5 years ago #

    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.

  3. mwrmwr
    Member
    Posted 5 years ago #

    >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')

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.