• 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

Disable Simple Hooks Code on landing page template (Prose theme)

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 › Disable Simple Hooks Code on landing page template (Prose theme)

This topic is: not resolved

Tagged: landing page, Prose theme, Simple Hooks

  • This topic has 15 replies, 3 voices, and was last updated 12 years ago by sheilam.
Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • June 8, 2013 at 9:13 am #44755
    sheilam
    Member

    Hi, I used simple hooks to add AdSense code to my site  http://courtreportercareers.net/

    However, I would like to disable the this code for the landing page as it contains my privacy policy. (which I put on the landing page template attempting to disable the code)

    How can I eliminate the Adsense ads from my privacy policy page?

    Thanks.

    Sheila

    http://courtreportercareers.net/
    June 8, 2013 at 9:32 am #44758
    rfmeier
    Member

    Hello,

    Have you tried using WordPress Conditionals before you output the code within the hook callback?

    Example;

    function my_custom_callback(){
    
            // if on home page, return
            if( is_home() )
                    return;
    
            // display your custom content
    
    }

    I hope this helps.


    Ryan Meier – Twitter

    June 8, 2013 at 9:57 am #44765
    Brad Dalton
    Participant
    if (is_page_template('landing.php') ) }
    

    or

    if ( is_page('007') ) }
    

    Replace 007 with the i.d for the landing page


    Tutorials for StudioPress Themes.

    June 8, 2013 at 1:21 pm #44801
    sheilam
    Member

    Thanks, Ryan and Brad, for the quick response.

    I went to the link you provided, Ryan but, I am quite illiterate when it comes to coding! I am totally lost.

    However, I can copy and paste!

    Where in heavens would I put the code you're referring to, Ryan, and, Brad, do I replace the "if" line of code that Ryan suggests with the code you provided.

    Thanks.

    Sheila

    June 8, 2013 at 2:10 pm #44804
    rfmeier
    Member

    Sheila,

    What hook were you using in the Simple Hooks plugin?


    Ryan Meier – Twitter

    June 8, 2013 at 2:46 pm #44810
    sheilam
    Member

    Ryan, I used:
    `genesis_before` Hook
    `genesis_before_content_sidebar_wrap` Hook
    `genesis_after_content_sidebar_wrap` Hook
    Sheila

    June 8, 2013 at 2:55 pm #44812
    rfmeier
    Member

    Sheila,

    Yes you would replace the code brad suggested within the if statement. So you could do something like this;

    if( is_page_template( 'landing.php' ) )
            return;
    
    // add your adsense code for display

    So, if you current page is the landing page template, it will return (exit) and not display the adsense.

    Make sure you check 'Execute PHP on this hook?'

    Let me know how it works, we may have to tweak it a little.


    Ryan Meier – Twitter

    June 8, 2013 at 4:53 pm #44827
    sheilam
    Member

    Hi Ryan,

    I made multiple attempts and tweaks to get that code to work but all it did was display the code with the adsense.

    I think that whatever I use may have to be inserted in the Custom Code or Custom CSS of this theme, Prose. And I did try that- still with no success.

    Thanks,

    Sheila

     

    June 8, 2013 at 5:15 pm #44833
    rfmeier
    Member

    Sheila,

    Are you able to post you code that would display your adsense?


    Ryan Meier – Twitter

    June 8, 2013 at 5:59 pm #44835
    sheilam
    Member

    Sure, I will just hide my ID.

    Here it is:

    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxxxxxxxxxxxxx";
    /* Before Header */
    google_ad_slot = "4381564314";
    google_ad_width = 728;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

    Thanks for helping me with this!

    Sheila

    June 8, 2013 at 7:51 pm #44843
    rfmeier
    Member

    Sheila,

    Looking back at one of your previous posts... You said it would just display the code. I did some quick testing and forgot to add the php tags.

    <?php
    
    if( is_page_template( 'landing.php' ) )
            return;
     
    // add your adsense code for display
    
    ?>
    

    That will let the code be executed.


    Ryan Meier – Twitter

    June 8, 2013 at 11:22 pm #44854
    Brad Dalton
    Participant

    Sheila

    Here's a good tutorial on how to use conditional tags in Simple hooks http://designsbynickthegeek.com/tutorials/conditional-page-content

    Another way to display Adsense in any genesis_hook position on single posts and exclude landing pages using conditional tags is to use a custom function.

    Code not displaying? Grab it on Github.

    Please copy the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor.

    You can easily change the genesis_before_content_sidebar_wrap to another hook position

    You can also use the new class (custom-content) to style your Adsense banners with padding etc.


    Tutorials for StudioPress Themes.

    June 8, 2013 at 11:41 pm #44856
    Brad Dalton
    Participant

    One more thing Sheila.

    All custom code for Prose goes in the Genesis > Custom Code box rather than the child themes functions.php file.

    If the code doesn't work when you save it in the Custom Code box, add it at the end of the lib/init.php file.

    I tested this and it works in both however the Genesis > Custom Code box is the preferred place for adding custom PHP code.

    What do you think Ryan?


    Tutorials for StudioPress Themes.

    June 9, 2013 at 6:22 am #44865
    sheilam
    Member

    Thanks, Brad and Ryan, for all of your assistance. But I am waving the white flag on this.

    I made multiple attempts applying the suggested code and reading the info you recommended to no avail. I am afraid it is a beyond my expertise to correct this.

    So, I removed the ad code in Simple Hooks. And, actually, my site looks less spammy because of it! 🙂

    Again, thanks.

    Shelia

    June 9, 2013 at 9:05 am #44889
    rfmeier
    Member

    First. Stupid me for having ad-block on while looking at your site. This whole time I was unable to see your ads. Geez-Louise!

    Brad,

    Good call on the Genesis Custom Code box. I agree is should be used over the plugin when possible.

    Sheila,

    If you still want to get this working, I could possibly wrap it up as a plugin for you. I cannot guarantee the timeframe to complete it, but I would be willing to help. You could contact me at [email protected] if you are still interested.


    Ryan Meier – Twitter

    June 9, 2013 at 1:52 pm #44915
    sheilam
    Member

    Hi Ryan,

    Thanks for 'fessing up  ;D

    And thanks for the offer for the plugin but I can go without it. I decided the site looks better without those link ads which I had installed via the simple hooks.

    But, it would be nice to have an easy way to exclude simple hooks on specific pages/posts/templates- well, an easy way for those of us who are technically challenged!

    Again, thank!

    Sheila

  • Author
    Posts
Viewing 16 posts - 1 through 16 (of 16 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