• 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

Placing adsense in single posts only?

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 › Placing adsense in single posts only?

This topic is: not resolved

Tagged: adsense, balance theme, create widget, single post, single.php

  • This topic has 8 replies, 3 voices, and was last updated 11 years, 6 months ago by Brad Dalton.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • June 6, 2013 at 1:53 am #44276
    guitario
    Member

    Is there a simple way to place a 728x90 adsense banner between my header image and my post headers in single posts only?

    Using my previous theme I simply added the code to the 'single.php' folder but my Balance child theme doesn't have this.

    So I'm assuming the code must go in the 'functions.php folder instead but can someone shed some light into where exactly and what code snippet I would need to make this work? (I don't understand php so please make it easy to understand)

    Thanks

    Jamie

    http://www.psycholocrazy.com/
    June 6, 2013 at 3:01 am #44277
    Brad Dalton
    Participant

    Hi Jamie

    You can do this several ways:

    1. using CSS code
    2. using PHP code
    3. creating a new widget area with conditional tag

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

    Code not displaying? Grab it on Github.

    You can change the hook position if needed.


    Tutorials for StudioPress Themes.

    June 6, 2013 at 3:43 am #44278
    guitario
    Member

    Hey Brad that worked great. One thing though, now that I have placed my banner ad there, there is a large white space between the ad and the header image/top menu.

    I will leave it there for you to have a look. Do you know how to reduce this, and to also leave a little white space between the bottom of the ad and the top of the post?

    Thanks

    Jamie

    June 6, 2013 at 3:45 am #44279
    guitario
    Member

    Wait, scrap the first part of that. It's because I have a lot of white space in the image header... I think...

    June 6, 2013 at 4:15 am #44282
    Brad Dalton
    Participant

    Line 260 of your child themes style.css file is where you can reduce the height of your header.

    .header-image #title-area,
    .header-image #title,
    .header-image #title a {
    	display: block;
    	float: left;
    	height: 135px;
    	overflow: hidden;
    	padding: 0;
    	text-indent: -9999px;
    	width: 350px;
    }
    

    Also on line 213

    #header {
    	margin: 0 auto;
    	min-height: 135px;
    	overflow: hidden;
    	width: 960px;
    }
    

    You may also need to reduce the height in your child themes functions.php file:

    /** Add support for custom header */
    add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 135 ) );
    

    Another solution is to use a smaller banner and use a different hook like genesis_before_post_title or genesis_after_post_title


    Tutorials for StudioPress Themes.

    June 6, 2013 at 5:02 am #44283
    guitario
    Member

    Thanks Brad that worked a treat!

    One last thing while you're here... How can I create a bit more white stuff after the banner? It seems very squashed against the top of my post where the date is and the heading on my sidebar.

    You've been a great help

    Jamie

    June 6, 2013 at 6:35 am #44286
    Brad Dalton
    Participant

    You can add some padding to the new widget area http://www.w3schools.com/css/css_padding.asp

    .before-content {
    padding-bottom: 24px;
    }
    

    I couldn't see the Adsense banner on single posts so cannot inspect the element using Firebug.


    Tutorials for StudioPress Themes.

    October 29, 2013 at 8:39 am #69631
    hobbygirl66
    Member

    How could you change this to include pages as well?
    Thanks!
    Lisa

    October 29, 2013 at 9:38 am #69650
    Brad Dalton
    Participant

    Sure thing:

    Change the HTML 5 Loop hook position if needed.


    Tutorials for StudioPress Themes.

  • 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