• Resolved davidallred

    (@davidallred)


    I’m looking for some advice. I am wanting a different image to show up on each page in the header. I am using the else_if commands and can get the different images showing up for all of my pages except the home page and blog page.

    I have the settings pointing to a static home page and have the blog at /blog.

    Here’s the code and the url is https://www.dityseo.com:

    <div id=”<?php
    if(is_page(‘home’)){
    echo “pagetitleseo”;}
    elseif(is_home()){
    echo “pagetitleseo”;}
    elseif(is_page(‘website-optimization’)){
    echo “pagetitlewebsiteoptimization”;}
    elseif(is_page(‘start-a-blog’)){
    echo “pagetitlestartablog”;}
    elseif(is_page(‘search-engine-optimization’)){
    echo “pagetitleseo”;}
    elseif(is_page(‘pricing’)){
    echo “pagetitlepricing”;}
    elseif(is_page(‘contact-us’)){
    echo “pagetitlecontact”;}
    elseif(is_page(‘blog’)){
    echo “pagetitleblog”;}
    ?>”></div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using is_front_page() instead of is_home() for the static front page. I don’t know about the blog.

    Thread Starter davidallred

    (@davidallred)

    @vtxyzzy – That worked perfectly for the front page. Thanks. Still trying to figure out the posts page or the blog page. Obviously it’s not connected to the name of the page in this case. If I figure it out, I’ll come back and post the solution.

    Thread Starter davidallred

    (@davidallred)

    is_home(‘blog’) worked! Not sure if I needed the ‘blog’ in there but all is good. Thanks!

    You are welcome. Now, please use the dropdown at top right to mark this topic ‘Resolved’.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘else_if not recognizing static home page and blog’ is closed to new replies.