WordPress.org

Ready to get started?Download WordPress

Forums

!is_page('home') not being reconised (8 posts)

  1. venomphil
    Member
    Posted 2 years ago #

    Hi WordPress community, I am trying to load different spans for specific pages using the !is_page('_')

    [code moderated - please use the pastebin for any code over the forum limit of 10 lines]

    This works perfectly apart from the homepage?
    Could anyone tell me whats wrong?
    Thanks

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    try to use:

    is_front_page()

    or

    is_home()

    http://codex.wordpress.org/Conditional_Tags#The_Main_Page

  3. venomphil
    Member
    Posted 2 years ago #

    <?php if( !is_page('is_front_page') && !is_page('page1') && !is_page('page2') && !is_page('page3') ) : ?>

    <?php if( !is_page('is_home') && !is_page('page1') && !is_page('page2') && !is_page('page3') ) : ?>

    Neither works? Is this the right way to add them? page1/page2/page3 work fine ^^

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    is_front_page() is to be used instead of is_page('home')

    for example, try:

    <?php if( !is_front_page() && !is_page('page1') && !is_page('page2') && !is_page('page3') ) : ?>

    or:

    <?php if( !is_home() && !is_page('page1') && !is_page('page2') && !is_page('page3') ) : ?>
  5. venomphil
    Member
    Posted 2 years ago #

    Appreciate your patience ^_^ top one worked for me

  6. venomphil
    Member
    Posted 2 years ago #

    What would be the !is.... for the blog page?

  7. Gary Darling
    Member
    Posted 2 years ago #

    Use is_home() for the blog page

  8. venomphil
    Member
    Posted 2 years ago #

    Perfect, thanks again

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.