page identification in wordpress

Community Forums Forums General Discussion page identification in wordpress

This topic is: not resolved

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  samsin89143 5 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #109779

    samsin89143
    Participant
    Post count: 3

    I am trying to setup a php conditional if statement to place in the simple hooks plugin so that when a specific page or post is called specific text is outputted above the header. I have successfully written that statement but the problem I am having is that when I specify the variable $page1 (which identifies the specific page I want the text to appear) I can’t seem to find how php identifies the page. The text I have used is showing on all pages and posts except the home page. I have tried using the WordPress id number, I have used the page name and I have even tried using the whole url for that page. Nothing seems to work. Does anyone how I can identify these pages to php? The page isn’t published yet.

    http://www.liveslimandfit.com
    #109784

    neilgee
    Member
    Post count: 133
    If( is_page( 49 ) ) {
    //code
    }

    The above example targets the page with an ID of 49


    #109794

    samsin89143
    Participant
    Post count: 3

    Thank you so much for that neilgee. If I want to have this work for multiple pages do I do this?

    if(is_page(49) || is_page(56)) {
    //code
    }

    Thanks again.

    #109799

    neilgee
    Member
    Post count: 133
    if( is_page (array( 49, 50, 51 ) )  ) {
    //code
    }

    For multiple you can work it in as an array


    #109822

    samsin89143
    Participant
    Post count: 3

    thank you for all the help Neil

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.