• 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 On Mobile

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 On Mobile

This topic is: not resolved
  • This topic has 12 replies, 2 voices, and was last updated 12 years, 10 months ago by Jon Bellah.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • January 27, 2013 at 9:22 am #15291
    heredia21
    Member

    How could I resize ad units on mobile devices?

    January 27, 2013 at 9:34 am #15297
    Jon Bellah
    Member

    That's a more complicated question than you may think. It's also one that doesn't (yet) have a clear answer. Here's an article from Smashing Magazine that should point you in the right direction, though.

    http://mobile.smashingmagazine.com/2012/11/29/making-advertising-work-in-a-responsive-world/


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 27, 2013 at 9:37 am #15299
    heredia21
    Member

    Well my ads are being cut off on my mobile site http://blackberryempire.com how could I use mobile ads for mobile devices? Other sites like seroundtable.com has same theme but on mobile devices it shows mobile ads.

    January 27, 2013 at 9:55 am #15302
    Jon Bellah
    Member

    The easiest, but not necessarily the best, way is to wrap your large ads in a div and your mobile ads in a div. Then use css to turn them on and off, based on viewport size. That would look something like this:

    Add to functions.php:

    // Add Viewport meta tag for mobile browsers
    add_action( 'genesis_meta', 'add_viewport_meta_tag' );
    function add_viewport_meta_tag() {
    	echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
    }
    

    The HTML:

    <div class="ad-large">
        <!-- Your Large Screen Ad Code Here -->
    </div>
    
    <div class="ad-mobile">
         <!-- Your Small Screen Ad Code Here -->
    </div>
    

    The CSS:

    .ad-large {
         display: block;
    }
    
    .ad-mobile {
         display: none;
    }
    
    
    @media only screen and (max-width: 480px) {
        .ad-large {
            display: none;
        }
    
        .ad-mobile {
            display: block;
        }
    }
    

    Keep in mind, though, that display:none; doesn't keep the browser from loading the hidden content. So you're still going to be loading the large and small ads, regardless of whether or not they're being shown.

    So, if you want to get a little better with your performance optimization, you can use something like ResponseJS to only load certain elements based on the viewport size.


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 27, 2013 at 10:02 am #15305
    heredia21
    Member

    Is doing this against Adsense policies?

    January 27, 2013 at 10:02 am #15306
    heredia21
    Member

    After I do the above How would i call it like in a widget to display the ads?

    January 27, 2013 at 10:05 am #15308
    Jon Bellah
    Member

    I don't know the particular policy for AdSense. That's something you'll have to read up on.

    You would just place the HTML in a widget, then manipulate it with the CSS in your style.css file.


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 27, 2013 at 10:17 am #15313
    heredia21
    Member

    When you said functions.php you meant in the Genesis functions? Or wordpress.

    January 27, 2013 at 10:18 am #15314
    Jon Bellah
    Member

    Your Genesis child theme. Not the actual Genesis theme.


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 27, 2013 at 10:32 am #15317
    heredia21
    Member

    Thanks for your help, that definitely did the trick! It is displaying mobile ad units on mobile devices now but since it is centered it is being cut off a bit, how can I remove the auto center?

    January 27, 2013 at 10:54 am #15321
    heredia21
    Member

    Would you happen to know where I can edit that? It is the Page Title widget. I dont want it centered unless i specify in the html

    January 27, 2013 at 11:28 am #15337
    heredia21
    Member

    Jon I contacted you on Twitter, if you could help me out with 2 things, I'd appreciate it. 1, NOT having ads or things i display in the ad blocks load at all because I believe it is against adsense policies and 2 removing the center style for the page-title widget.

    January 27, 2013 at 11:48 am #15346
    Jon Bellah
    Member

    how can I remove the auto center?
    You have the ad wrapped in tags.

    1, NOT having ads or things i display in the ad blocks load at all because I believe it is against adsense policies
    Check out ResponseJS, it may be able to do what you're looking for. It should also have documentation to help you set it up.

    That's about as much as I can help you. Sorry.


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

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