• I am making a WordPress theme and the homepage looks different than the rest of the pages. I want to use PHP to make it so if a user is on the homepage, it will display something. If they’re on a different page, it will display something else. I am not the smartest person when it comes to PHP, so what could I do? Any help would be appreciated ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • peredur

    (@peredur)

    Check out the WordPress Template Hierarchy.

    HTH

    PAE

    Thread Starter Connor Crosby

    (@ccmovies)

    Thanks, but I don’t think that’s what I am looking for.

    peredur

    (@peredur)

    Then could you explain what you do want? I think most of us would gather from what you’ve posted that you want a different template for your home page from your other pages.

    The other thing you might want, I guess, is to check whether the home page is being displayed or not… In which case you’d probably want to use conditional conditional tags. Which is how a choice of template is made, of course; but you can use them to just put conditional code in a single template, if you want.

    HTH

    PAE

    Thread Starter Connor Crosby

    (@ccmovies)

    Okay, sorry for the confusion. This is going to be put in the header.php file. I want to make it so if the homepage it being shown, a div container will be displayed. If it’s not the homepage, then I want a different div container to be displayed. Thanks! ??

    peredur

    (@peredur)

    No problem. Sounds as though conditional tags are what you need.

    Cheers

    PAE

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘If Home, Display Something, If Else, Display Something Else’ is closed to new replies.