• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Why oh why doesn't my if statement work?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Why oh why doesn't my if statement work?

This topic is: resolved

Tagged: custom header homepage

  • This topic has 6 replies, 3 voices, and was last updated 11 years, 10 months ago by Lauren @ OnceCoupled.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • August 19, 2014 at 11:33 am #119802
    cosmocanuck
    Member

    Hi all! I'm pretty new to Genesis but moderately good at PHP and template modification, though there's always new struggles, aka "$#@! learning opportunities". 8^)

    That said, I'm trying to have a different image in my homepage header than on other pages. Simple, no? No. Every method I've located to do this seems horribly complicated, and I've yet to get it to work. I'd rather code it, not rely on a plugin. Here's what I did in my functions.php file:

    Lines 15-19 are the only change I made - a simple 'if' statement. BUT... I'm getting the same image on all pages, the "special case" homepage line is seemingly ignored.

    is there some Genesis mojo I don't know about that is keeping this from working?

    Many many MANY thanks for any help.

    Adam

    http://www.snapshotscollective.com/wp/
    August 19, 2014 at 11:45 am #119804
    Tony @ AlphaBlossom
    Member

    Hey Adam,

    Your code didn't post. Try it in the code tags, or maybe use something like http://pastebin.com/ and post the link so we can try to help.

    Thanks,
    Tony


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    August 19, 2014 at 11:45 am #119805
    Lauren @ OnceCoupled
    Member

    Basic question, but have you tried using if ( is_home() || is_front_page() ) {?


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    August 19, 2014 at 11:55 am #119815
    Tony @ AlphaBlossom
    Member

    Thanks Lauren...wierd, I saw the link in my email, but nowhere on the forum :/

    Luaren's recommendation should take care of it...there's a good chance your theme is using front-page.php for the home page, so you have to check for is_front_page.

    You might have to remove is_home, depending on your setup...that may cause the image to also show on the blog home page.


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    August 19, 2014 at 12:01 pm #119816
    cosmocanuck
    Member

    Here's a pastebin version. Lauren, I did use that code as well but it seemed not to make a difference...

    http://pastebin.com/dcppyiSa

    August 19, 2014 at 12:04 pm #119817
    cosmocanuck
    Member

    Disregard my last post, everyone - Lauren's suggestion DID work!

    Thanks so much!

    August 19, 2014 at 5:29 pm #119889
    Lauren @ OnceCoupled
    Member

    Tony, I also couldn't get the gist to link nor embed, so I ended up just removing it to reduce confusion for anyone else who stumbled onto this forum.


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Why oh why doesn't my if statement work?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble