• 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

Outreach Pro Theme – Different Background on Pages

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 › Outreach Pro Theme – Different Background on Pages

This topic is: not resolved

Tagged: background, Outreach Pro

  • This topic has 4 replies, 2 voices, and was last updated 6 years, 8 months ago by PainterMommy.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 5, 2016 at 6:12 pm #188932
    PainterMommy
    Member

    I am working on a site (http://kraftlove.com) and the client would like to have a custom background on her pages, but when I go to add a background through the dashboard, the same background shows up behind the slider on the homepage. How can I have it so that the homepage stays the same and I can add a background on the pages / posts instead?

    I am a novice when it comes to coding so I appreciate any help that you might have for me. 🙂

    DAWN

    http://kraftlove.com
    July 5, 2016 at 7:22 pm #188935
    Victor Font
    Moderator

    The custom background is actually a WordPress function, not Genesis. It's a little complicated to do you what you want because you need to create your own custom function to replace the WordPress functionality. The whole reason for this is because the WordPress function creates inline CSS. All we have to do is add :not(.home) to the CSS, but to get there, you have to do the following:

    Find add_theme_support( 'custom-background' ); in the Outreach Pro functions.php and replace it with the entire block of code below. I've tested this with Outreach Pro in my local environment and it works. Be very, very careful editing functions.php. If you make a mistake, it will bring down your site and you will have to correct it through FTP. FTP is my preferred way for editing the functions file.

    $my_defaults = array(
    				'default-image'          => '',
    				'default-repeat'         => 'repeat',
    				'default-position-x'     => 'left',
    				'default-attachment'     => 'scroll',
    				'default-color'          => '',
    				'wp-head-callback'       => 'my_custom_background_cb',
    				'admin-head-callback'    => '',
    				'admin-preview-callback' => '',
    			);
    			
    add_theme_support( 'custom-background', $my_defaults );
    
    function my_custom_background_cb() {
    	// $background is the saved custom image, or the default image.
    	$background = set_url_scheme( get_background_image() );
    
    	// $color is the saved custom color.
    	// A default has to be specified in style.css. It will not be printed here.
    	$color = get_background_color();
    
    	if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {
    		$color = false;
    	}
    
    	if ( ! $background && ! $color )
    		return;
    
    	$style = $color ? "background-color: #$color;" : '';
    
    	if ( $background ) {
    		$image = " background-image: url('$background');";
    
    		$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
    		if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
    			$repeat = 'repeat';
    		$repeat = " background-repeat: $repeat;";
    
    		$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    			$position = 'left';
    		$position = " background-position: top $position;";
    
    		$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
    		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
    			$attachment = 'scroll';
    		$attachment = " background-attachment: $attachment;";
    
    		$style .= $image . $repeat . $position . $attachment;
    	}
    ?>
    <style type="text/css" id="custom-background-css">
    body.custom-background:not(.home) { <?php echo trim( $style ); ?> }
    </style>
    <?php
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 6, 2016 at 12:18 pm #188973
    PainterMommy
    Member

    Thanks so much, I have added your code to the functions.php. I then went into the admin panel and uploaded the custom background image. But when I look at the site, I am not seeing the background. I know you mentioned needing to update the CSS. Can you tell me what code and where I need to add it exactly? Maybe that is what is missing? I so appreciate your help!

    DAWN

    July 6, 2016 at 2:56 pm #188981
    Victor Font
    Moderator

    That code does update the CSS. The color from your .site-inner at line 478 in style.css is covering the background image. The background image is behind it. You either have to remove the background-color or change it to something with a little transparency. background-color: rgba(0,0,0,0.3);


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 11, 2016 at 8:07 am #189244
    PainterMommy
    Member

    Thankyou!!! That did it!!! 🙂

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

© 2023 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