• 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

I want to place ad code below the header in Magzine 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 › I want to place ad code below the header in Magzine theme

This topic is: resolved

Tagged: adsense, header, html, magazine

  • This topic has 16 replies, 4 voices, and was last updated 11 years, 4 months ago by Ryan Kennedy.
Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • July 18, 2014 at 10:55 pm #114887
    Ryan Kennedy
    Member

    Hello,

    Where can I place my adsense HTML code in order for it to appear below the header in the magazine theme? I don't know how to access the HTML code for my theme.

    any help is greatly appreciated.

    Thanks in advance.

    http://www.stylefeels.com/
    July 18, 2014 at 11:20 pm #114891
    Genesis Developer
    Member

    use genesis_after_header hook . See Code snippet hre http://gregrickaby.com/genesis-code-snippets/


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 19, 2014 at 10:47 am #114927
    DTHkelly
    Member

    Create a widget area and hook it as genwrock indicated. Drag a text widget into this widget area. Paste HTML in the text widget.

    http://www.carriedils.com/add-widget-area-below-nav/
    Although this tutorial addresses Calls to action,the hook is the same you need

     add_action( 'genesis_after_header', 'mp_cta_genesis' );{ 

    Change

     mp_cta_genesis 

    to the name of your custom adsense widget area after header. Also line 5

     function mp_cta_genesis() { 

    Not your desired hook, but some additional reference:
    http://wpselect.com/add-google-adsense-to-genesis-framework-theme/
    http://www.bitdoz.com/1637/add-custom-widgets-advertisements-genesis-framework/

    How to display Google ad in Primary sidebar above widgets in Genesis

    Hope this helps!

    July 20, 2014 at 6:48 am #115025
    Brad Dalton
    Participant

    Add a new widget would be easiest http://wpsites.net/web-design/adding-new-widget-areas-in-studiopress-themes/


    Tutorials for StudioPress Themes.

    October 1, 2014 at 10:17 am #126441
    Ryan Kennedy
    Member

    Thanks for all the help. I've successfully added a new widget area. The problem I'm having is editing the functions.php so that the new widget are show up on all pages all the time just like the header. I messed around with the conditional tags but I'm not to confident what code to use.

    Any help is greatly appreciated


    @braddalton
    your site is very helpful

    October 1, 2014 at 6:35 pm #126485
    Brad Dalton
    Participant

    Positive feedback always welcome Ryan!


    Tutorials for StudioPress Themes.

    October 3, 2014 at 7:01 pm #126715
    Ryan Kennedy
    Member

    @braddalton

    The problem I’m having is editing the functions.php so that the new widget are show up on all pages all the time just like the header. I messed around with the conditional tags but I’m not to confident what code to use. Can you point me in the right direction?

    October 3, 2014 at 7:33 pm #126719
    Brad Dalton
    Participant

    Just remove the conditional tags and one of the closing brackets.


    Tutorials for StudioPress Themes.

    October 3, 2014 at 7:41 pm #126720
    Ryan Kennedy
    Member

    Can you show me perhaps?

    genesis_register_sidebar( array(
    'id' => 'new-widget',
    'name' => __( 'New Widget', 'domain' ),
    'description' => __( 'Add Content Here', 'domain' ),
    ) );

    add_action( 'genesis_after_header', 'your_widget' );
    function your_widget() {
    if ( is_home() && is_active_sidebar('new-widget') ) {
    genesis_widget_area( 'new-widget', array(
    'before' => '<div class="new-widget widget-area">',
    'after' => '</div>',
    ) );

    }

    }

    October 3, 2014 at 8:00 pm #126724
    Ryan Kennedy
    Member

    @braddalton

    Can you explain what I need to remove a little more in depth?

    October 3, 2014 at 8:08 pm #126726
    Brad Dalton
    Participant

    Please remove this part only

     is_home() &&

    Tutorials for StudioPress Themes.

    October 3, 2014 at 8:12 pm #126727
    Ryan Kennedy
    Member

    @braddalton

    That messes up my whole page from loading for some reason. ?

    October 3, 2014 at 8:20 pm #126728
    Brad Dalton
    Participant

    If you embed the code incorrectly in a web page and then someone copies and pastes it, it will break their site.

    The line i refer to should now look like this:

    if ( is_active_sidebar('new-widget') ) {
    

    Grab the code from the Gist and try again please using a code editor like Notepad++.


    Tutorials for StudioPress Themes.

    October 3, 2014 at 8:30 pm #126730
    Ryan Kennedy
    Member

    @braddalton

    I really appreciate your help.

    When I made the correction to the code in text wrangler and entered it into the function.php my site loaded fine however the widget area did not show up anywhere except on the widget page.

    October 3, 2014 at 9:01 pm #126732
    Brad Dalton
    Participant

    You will need to populate the widget area for it to display something on the front end Ryan.


    Tutorials for StudioPress Themes.

    October 4, 2014 at 9:29 am #126760
    Ryan Kennedy
    Member

    @braddalton

    Yes I have advertising code in the widget area and It does show up on the front page with the original code from your site, however when I remove is_home() && conditional tag it then doesn't show on any page. Is there something else I am missing or another way to go about it. I also tried to set the visibility in the widget section also.

    October 4, 2014 at 9:39 am #126761
    Ryan Kennedy
    Member

    @braddalton

    Ok, I gave it another try and it is working correctly. I greatly appreciate your help. Let me know how I can repay you.

    Thanks a lot

    Ryan

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

© 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