• 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

Ads in Header Right messing up Mobile Responsive Design

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 › Ads in Header Right messing up Mobile Responsive Design

This topic is: not resolved

Tagged: mobile responsive design

  • This topic has 3 replies, 2 voices, and was last updated 12 years, 1 month ago by Debra Scott.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 5, 2013 at 12:10 am #44114
    mistydawnkearns
    Member

    Hello, many of my clients have a leaderboard size ad (728 wide) in their header right widget area.  Now that I am switching them over to mobile responsive themes, I am  having an issue with this ad messing up the mobile site.

    Is there any way to code it where the header right widget does not show up on the mobile responsive view?  Or something I'm missing on making this work?

    Here's a link for an example on my personal blog  if you pull it up on a mobile device you will see how the ad takes over the screen and makes the blog content really small:

    http://justmisty.com

    Thank you so much for any help. I've been researching like crazy on this.

    Misty

    http://justmisty.com
    June 5, 2013 at 4:41 am #44130
    Debra Scott
    Member

    use this code in your text widget

    
    <script type="text/javascript">
    var width = window.innerWidth || document.documentElement.clientWidth;
    google_ad_client = "ADSENSE PUBLISHER ID HERE";
    if (width >= 800) {
     google_ad_slot = "AD ID NUMBER HERE";
     google_ad_width = 728;
     google_ad_height = 90;
    } else {
     google_ad_slot = "AD ID NUMBER HERE";
     google_ad_width = 320;
     google_ad_height = 50;
    }
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
    
    

    You can find the ad ID number from your My Ads section of your adsense. You can see the code in action here

    Note: original source for code


    need help with your business or personal website? Contact me at Fat Cat Designs

    June 5, 2013 at 2:08 pm #44198
    mistydawnkearns
    Member

    Thanks Debra, that will work for adsense but not all my clients ads are adsense.  I appreciate the help!

    I also did figure out this morning how to code it so the header right doesn't show. In case anyone else needs to know- in the mobile responsive part for the smaller media screens simply change or add:

    #header .widget-area {display:none;}

    June 5, 2013 at 2:46 pm #44208
    Debra Scott
    Member

    you could also do a conditional code for the header widget to either show a smaller ad or leave the else empty which will literally display nothing.


    need help with your business or personal website? Contact me at Fat Cat Designs

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