• 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

Need help with Conditional Tags

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 › Need help with Conditional Tags

This topic is: not resolved

Tagged: conditional tags, genesis, Genesis Simple Hooks, parallax-pro

  • This topic has 8 replies, 2 voices, and was last updated 10 years, 6 months ago by kavikalyn.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • April 29, 2015 at 1:01 pm #149531
    kavikalyn
    Member

    Hello, I'm using Genesis with the Parallax Pro theme. I want to show a Google Adsense 728x90 banner ad at the top and the bottom of each page except the home page. I've got the homepage set up with the parallax blocks and it looks really bad with ads.

    I'm using the Genesis Simple Hooks plugin to add the Adsense code to the genesis_before_loop and genesis_after_loop tags and the pages look great. I just need a way to not show the ads on the homepage.

    I contacted Synthesis support and they said I needed to use conditional tags and sent me a link to this page: http://codex.wordpress.org/Conditional_Tags

    I understand the idea behind how these work I'm just not sure how to exactly write the code. I basically need a bit of code to put in the Genesis hooks that says:

    If it's the home page > Don't do anything
    If it's not the home page (any other page on the site) > show Adsense code in this hook

    Can anyone help me out with this? I imagine it should be pretty simple.

    Thanks in advance for any help.

    April 29, 2015 at 2:30 pm #149538
    Brad Dalton
    Participant

    Add

    if ( ! is_front_page())

    Home page relates to your posts page so i assume you mean the front page otherwise use

    ! is_home()

    Examples http://designsbynickthegeek.com/tutorials/conditional-page-content


    Tutorials for StudioPress Themes.

    April 29, 2015 at 4:23 pm #149549
    kavikalyn
    Member

    That link was helpful, thanks. So is this right? I want to show the ads on every page except the home page (it's a specific page not my posts page).

    if(is_singular()) { ?>
    ADSENSE CODE
    <?php }

    And in theory that would show on every single page except the home page and I just paste that code into the simple hooks plugin?

    There's no way to do an "is not home page" is there?

    April 29, 2015 at 4:26 pm #149550
    Brad Dalton
    Participant
    ! is_home()

    Excludes the home page and displays on every other page including archives, pages and posts.

    I wouldn't use the plugin. I would use code in the functions file like:

    -
    add_action( 'genesis_before_loop', 'adsense' );
    function adsense() {
    if ( !is_home() ) {
    echo'Your Script';
        }
    }
    

    Even better to create a widget


    Tutorials for StudioPress Themes.

    April 29, 2015 at 4:36 pm #149553
    Brad Dalton
    Participant

    This is the best way http://wpsites.net/web-design/widget-genesis/


    Tutorials for StudioPress Themes.

    April 29, 2015 at 5:25 pm #149556
    kavikalyn
    Member

    Thanks for the help so far.

    I tried adding the following to the function.php file:

    add_action( 'genesis_before_loop', 'adsense' );
    function adsense() {
    if ( !is_home() ) {
    echo'Your Script';
        }
    }

    And it showed the ads in the correct location but still showed them on the homepage.

    I'm not very comfortable with the coding and with creating a widget area so I'd rather just use the simple hooks plugin.

    I tried putting the following in the simple hooks plugin:

    if(! is_home()) { ?>
    ADSENSE CODE
    <?php }

    And that didn't work either.

    April 29, 2015 at 5:42 pm #149557
    Brad Dalton
    Participant

    Link to your home page please.

    Did you try

    if ( ! is_front_page())

    If you only want it on single posts, use:

    if ( is_singular('post') )
    

    Tutorials for StudioPress Themes.

    April 29, 2015 at 5:44 pm #149558
    kavikalyn
    Member

    Home

    I have a coming soon plugin but I disabled it for a bit so you can see the homepage.

    Thanks.

    April 30, 2015 at 3:06 pm #149662
    kavikalyn
    Member

    Is anyone else out there able to help?

    I need to know what code for conditional tags to put around my Adsense code so ads will show on every page except the homepage.

    I'm entering this code in genesis_before_loop and genesis_after_loop using the Genesis Simple Hooks plugin.

    Thanks in advance for any help.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 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