• 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

Seeking help with hook with conditional statement

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 › Design Tips and Tricks › Seeking help with hook with conditional statement

This topic is: resolved

Tagged: conditional statement, hook, syntax error

  • This topic has 7 replies, 2 voices, and was last updated 12 years, 7 months ago by Brad Dalton.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • October 24, 2013 at 10:47 am #68650
    Jumpringer
    Member

    Goal: display a different image that displays beneath the header on specified pages.

    The original "Beautiful Pro" template code is this:

    //* Hook site header banner after header
    add_action( 'genesis_after_header', 'beautiful_site_header_banner' );
    function beautiful_site_header_banner() {

    echo '<div class="site-header-banner"></div>';

    }

    My revised code (which has a syntax error I can't resolve) is this:

    //* Hook site header banner after header

    if (is_home())

    add_action( 'genesis_after_header', 'beautiful_site_header_banner' );

    function beautiful_site_header_banner() {

    echo '<div class="site-header-banner"></div>';

    } elseif (is_page('?page_id=12'))

    add_action( 'genesis_after_header', 'beautiful_site_header_banner' );

    function beautiful_site_header_banner_custom() {

    echo '<div class="site-header-banner-add"></div>';

    }

    These two lines display as php errors when viewed in Dreamweaver:

    add_action( 'genesis_after_header', 'beautiful_site_header_banner' );

    function beautiful_site_header_banner_custom() {

    If you can point me in the right direction, it will be appreciated!

    October 24, 2013 at 12:05 pm #68663
    Brad Dalton
    Participant

    How many pages and how many images do you want to display after the header?

    Please paste code in a Github Gist or Pastebin.

    What is the error message?


    Tutorials for StudioPress Themes.

    October 24, 2013 at 4:19 pm #68720
    Jumpringer
    Member

    8 additional pages each with a different image that displays beneath the header.

    Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' in /usr/www/users/me/stage/dev/my_site/wp-content/themes/beautiful-pro/functions.php on line 110

    <script src="http://pastebin.com/embed_js.php?i=Qh0SRziH"></script>

    pastebin title:Hook with conditional statements

    Thanks.

    October 24, 2013 at 4:47 pm #68726
    Brad Dalton
    Participant

    The code i looked at is not written properly.

    You might be better off using a custom field to add different images after the header http://wpsites.net/web-design/add-unique-header-images-using-custom-fields/


    Tutorials for StudioPress Themes.

    October 25, 2013 at 11:41 am #68869
    Brad Dalton
    Participant

    Try this http://wpsites.net/web-design/display-different-after-header-images-in-beautiful-pro-theme/


    Tutorials for StudioPress Themes.

    October 25, 2013 at 12:21 pm #68879
    Jumpringer
    Member

    Just what I was looking for! I did begin the custom field approach described in your previous post, but this technique with the conditional statement is more streamlined. I'll keep this post open until I finish my coding. Thanks again.

    October 25, 2013 at 3:00 pm #68925
    Jumpringer
    Member

    Brad, I successfully used your code here: http://wpsites.net/web-design/display-different-after-header-images-in-beautiful-pro-theme/

    and added one more condition, which worked fine. You rock.

    October 25, 2013 at 5:50 pm #68959
    Brad Dalton
    Participant

    Good stuff.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Seeking help with hook with conditional statement’ 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