• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Remove Background Image If Specific Genesis Layout

This code answers the following question from a member of the Genesis community:

Question : Is there a remove_action I can add to a page template to remove the site’s background image on that layout?

Answer : Yes, there’s at least 2 ways to remove the background image based on what layout the page is loading.

The 1st solution enables you to remove the image using a custom function which checks the default layout via your child themes functions file. In the following example, the image is removed only on pages where a full width content layout option is set.

add_action( 'genesis_meta', 'remove_back' );

function remove_back() {

    $site_layout = genesis_site_layout();
	
    if ( 'full-width-content' === $site_layout ) {
	
    remove_theme_support( 'custom-background' );

    }
}

Swap out full-width-content in the above code snippet with any of the following default layout options included in most Genesis child themes.

content-sidebar
sidebar-content
content-sidebar-sidebar
sidebar-sidebar-content
sidebar-content-sidebar
full-width-content

The 2nd solution enables you to add the code directly to a template file like your front_page.php or page_landing.php file :

remove_theme_support( 'custom-background' );

You can add the single line of code above to any template file included in the WordPress Template Hierarchy.

Background Image

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags