• 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

Remove Custom Background for mobile devices

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 › Remove Custom Background for mobile devices

This topic is: not resolved

Tagged: custom background, media queries, winning agent

  • This topic has 3 replies, 2 voices, and was last updated 11 years, 5 months ago by Sridhar Katakam.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • July 30, 2014 at 6:55 pm #116391
    ngarrett
    Member

    I'm using the winning agent child theme-I know there is a forum just for this theme but I was having troubles logging in for whatever reason so I was unable to post their.

    I have a full width custom background and was wondering if someone could help with the css coding to remove the background when visitor is using a mobile device (like: @media only screen and (max-device-width : 640px)).

    Using the firebug inspector tool I was unsuccessful trying this on my own.

    My goal is to speed up the website when visitors are viewing listings-which is enough to load on it's own.

    Hopefully this will help cut back on the load time. Any suggestions?!?!?

    Thanks

    http://garrettsrealty.com
    July 30, 2014 at 7:35 pm #116394
    Sridhar Katakam
    Participant

    I see that your site/theme uses Backstretch for the full screen background image. You can install a plugin like mobble, find the code where backstretch is being enqueued and wrap it in an if conditional, ! is_handheld() so that it works only on non handheld devices.


    Genesis Tutorials | Follow me on Twitter

    July 31, 2014 at 7:08 pm #116506
    ngarrett
    Member

    Thank you Sridhar for replying, I think I found what you are speaking of below. But I am a little confused on how I wrap it in an if conditional for non handheld devices.

    `// Enqueue Backstretch scripts only if custom background is being used
    if ( get_background_image() ) {

    wp_enqueue_script( 'wap-backstretch', get_stylesheet_directory_uri() . '/lib/js/backstretch.js', array( 'jquery' ), '1.0.0' );
    wp_enqueue_script( 'wap-backstretch-set', get_stylesheet_directory_uri() .'/lib/js/backstretch-set.js' , array( 'jquery', 'wap-backstretch' ), '1.0.0' );
    wp_localize_script( 'wap-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );
    `

    Would I edit it directly in the child themes functions.php or in the css.stylesheet

    Thanks

    July 31, 2014 at 7:17 pm #116508
    Sridhar Katakam
    Participant

    Try this:

    After activating Mobble, take a backup of the child theme's functions.php and directly change the above code in it to:

    // Enqueue Backstretch scripts only if custom background is being used and for non handheld devices (mobiles, tablets etc.)
    if ( get_background_image() && ! is_handheld() ) {
    
    	wp_enqueue_script( 'wap-backstretch', get_stylesheet_directory_uri() . '/lib/js/backstretch.js', array( 'jquery' ), '1.0.0' );
    	wp_enqueue_script( 'wap-backstretch-set', get_stylesheet_directory_uri() .'/lib/js/backstretch-set.js' , array( 'jquery', 'wap-backstretch' ), '1.0.0' );
    	wp_localize_script( 'wap-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );
    }

    Genesis Tutorials | Follow me on Twitter

  • 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

© 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