BuddyDev

Search

Custom background

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14544

    Hi Jill,
    Please use the following code

    
    
    // disable the custom profile background generated css.
    add_filter( 'bppg_iwilldo_it_myself', '__return_true' );//do not generate css for us
    
    //Our own css
    function buddydev_custom_inject_css() {
    	if ( ! function_exists( 'bppg_get_image' ) ) {
    		return ;// no trouble when the plugin is disabled
    	}
    
    	$image_url = bppg_get_image();
    
    	if ( empty( $image_url ) ) {
    		return;
    	}
    
    	$repeat_type = bp_get_user_meta( bp_displayed_user_id(), 'profile_bg_repeat', true );
    
    	if ( ! $repeat_type ) {
    		$repeat_type = 'repeat';
    	}
    	?>
    	<style type="text/css">
    		body.is-user-profile #buddypress div#item-body{
    			background: url(<?php echo $image_url; ?>);
    			background-repeat: <?php echo $repeat_type; ?>;
    		}
    
    	</style>
    	<?php
    }
    add_action( 'wp_head', 'buddydev_custom_inject_css', 200 );
    

    You may experiemnet with the css selector to aplly the image to various other parts.

    Best Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14593

    I will give this a try! Any word on the mediapress and site wide activity plugin? Thank you so much for all of your help!

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14600

    You are welcome. Please do let me know how it goes.

    About the MediaPress, I haven’t released an update on wp.org as I am trying to include 2 more developer oriented features in this release. I will need 2 more days.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14601

    very cool about mediapress, I can’t wait!!

    Does that code you gave go in my js file or function.php file?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14602

    Thank you.
    functions.php is the correct place for it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14710

    It worked! You’re amazing. thank you!

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14711

    Is there a way that if someone chooses not to repeat the background that it can have the css style to cover the space?

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14712

    sorry, last question…is there a way to only have the background show up on people’s wall page and not all of the profile pages?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14715

    Hi Jill,
    Sure.

    changing this

    
    if ( ! function_exists( 'bppg_get_image' ) ) {
    		return ;// no trouble when the plugin is disabled
    }
    
    

    to this

    
        if ( ! bp_is_user_activity() || ! function_exists( 'bppg_get_image' ) ) {
    	    return ;// don't do anything on non activity page.
        }
    
    

    Will do it.

    Best regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Jill Bowers on #14726

    Thank you so much. Once again, that worked. I really really appreciate all of the help and guidance you give. Thank you!

You must be logged in to reply to this topic.

This topic is: not resolved