• 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

Limit Hook to Specific Page

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 › Limit Hook to Specific Page

This topic is: not resolved
  • This topic has 4 replies, 3 voices, and was last updated 12 years, 1 month ago by Brad Dalton.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • December 20, 2013 at 10:15 am #80464
    mrhiking
    Member

    I'm using Genesis Simple Hooks plugin. I've put Google Adsense script on the page.

    I only want to show the Google Adsense on the single post page, not the home page.

    Any idea how I do that?

    FreeChristian.us

    December 20, 2013 at 5:51 pm #80528
    nutsandbolts
    Member

    Can you paste in what you've got in Simple Hooks?


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 23, 2013 at 12:38 pm #80926
    mrhiking
    Member

    Simple Hooks: genesis_after_content Hook

    <div style="margin-left: 25px"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- FreeChristian - Post Content -->
    <ins class="adsbygoogle"
    style="display:inline-block;width:728px;height:90px"
    data-ad-client="ca-pub-8570710838480654"
    data-ad-slot="8022033335"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>

    December 23, 2013 at 12:52 pm #80932
    nutsandbolts
    Member

    Okay, try this. Check the box to execute PHP on the genesis_after_content hook, then change your code to this:

    <?php 
        if( is_single() ) { ?>
    <div style=”margin-left: 25px”><script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– FreeChristian – Post Content –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:728px;height:90px”
    data-ad-client=”ca-pub-8570710838480654″
    data-ad-slot=”8022033335″></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
    <?php
    }
    ?>

    You might need to try the genesis_after_entry hook to get it to display correctly - putting it in genesis_after_content seems to want to put it between the content and sidebar.


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 24, 2013 at 3:54 am #81049
    Brad Dalton
    Participant

    Why don't you add a custom field so you can add relevant ads to posts in different categories. http://wpsites.net/best-plugins/add-custom-content-outside-the-content-area/


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ 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

© 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