WP help with enqueueing new style for Buddypress

Please go easy on me as I have no experience here.

I want to replace BuddyPress’s style with a custom named one and have been told that the filename is hardcoded. I managed to piece some code together and get the file to load but for some reason, the layout won’t change. Here is the code I am using to enqueue the file please let me know if its wrong in any way.

//* Remove bp-nouveau style
    add_action( 'wp_enqueue_scripts', 'remove_bp_nouveau_styles', 11 );
    function remove_bp_nouveau_styles() {
    	wp_dequeue_style( 'bp-nouveau');
           
}

//* Register and Enqueue Stylesheet
function community_profile() {
    	wp_enqueue_style( 'community-profile', get_stylesheet_directory_uri() . '/css/profile.css', false, null, 'all' );
        
	}
add_action( 'wp_enqueue_scripts', 'community_profile' );

Prime, the first code removes the style sheet. The second gets it. Therefore the second would fail.
The first code removes the Buddypress styling. This is a Buddypress routine!
The second code is WP code which is for the WP site, not the buddypress plugin.

I think this is incorrect. Going by Buddypress docs, BP Styles-Theme, you can alter any part of the plugin’s styling, but, you need to enter the changes in the standard css for the website. It says to just put all your style changes in this CSS area:

#buddypress .activity-content {
 
}

But, you would need to inspect the code CSS for Buddypress to know which to change. Hope this helps!

I only ran the first part of that code because I had renamed the default BuddyPress.css file to something else that felt more appropriate for the task I was going to use it for. And since the name and extension of it was hard-coded I could not just rename the references in the functions file and it would load. I would have to enqueue it again. But I had a feeling that code would not work so I guess I was on the wrong track.

I did read as much as I could on the docs part of Buddypress’s site but some parts seem to be missing the majority of information on things. All I really wanted to do was just rename some of the file names,CSS tags and some div id’s or classes that go with them that’s all. Anyway, I will try to reach out in the WP section as you mentioned.

Thanks again for your guidance.

Well, you could rename their CSS, make a new copy of it and then edit it to fit your needs.
That should work. Just alter the #buddypress.whatever’s in their code to fit your needs.
Sorry I could not help further.

Dude you have no idea how much of a help you have been :smiley: I can’t begin to thank you enough.

I do have one other thing I would like to ask you about. There is some kind of div wrapper they use. Whats your input on changing that?

Do you mean there is a DIV named wrapper or a division name wrapper? or <div class=‘wrapper’
???

Crap I’m sorry Ill post it.


	/**
	 * Add our special 'buddypress' div wrapper to the theme compat template part.
	 *
	 * @since 3.0.0
	 *
	 * @see bp_buffer_template_part()
	 *
	 * @param string $retval Current template part contents.
	 *
	 * @return string
	 */
	public function theme_compat_wrapper( $retval ) {
		if ( false !== strpos( $retval, '<div id="buddypress"' ) ) {
			return $retval;
		}

		// Add our 'buddypress' div wrapper.
		return sprintf(
			'<div id="buddypress" class="%1$s">%2$s</div><!-- #buddypress -->%3$s',
			esc_attr( bp_nouveau_get_container_classes() ),
			$retval,  // Constructed HTML.
			"\n"
		);
	}

Well, it appears that it is an override for Wordpress. It will only work with Wordpress templates that are set up for this. Most WP templates should accept it. It probably let’s you override the theme for your WP template with the additional parts for the Buddypress CSS. I can download a copy of Buddypress tomorrow and look it over further for you. Short on time right now.

No problem I understand and I would appreciate that very much. And thank you for the explanation I will take note of it.

Looks like I can peek at it later tonight. My plans changed. By the way, what Wordpress Theme are you using? Is it a public one?

I use one called newscard I use the free version of it.

Okay, leaving for a bit, but, I will peek at both later tonight and see what I can figure out for you.
Later…

Alright thanks again.

Okay, I have WP, Newscard and Buddypress, so will play with them tomorrow. But, I have plans for several hours. So might take awhile to check out all the code!

no problem take your time.

I just wanted to let you know I might be on to something that might help avoid all this. I made a topic here and they suggested a feature for a plugin I am currently using called wp hide and security enhancer. I tried messing with the feature they had suggested but was unable to get it to work. Apparently, it has the ability to rename anything in the HTML meaning divs etc. I tried the code they gave me but it did not work for me. The only thing I am wondering is if it can be used multiple times. Anyway, I just wanted to give you an update and say I hope you are feeling better.

Never mind. It’s a fail.

Sorry Prime, I have been off the site for awhile due to various issues.
Minor health issues all fixed up now and a lot of family issues. Selling our family home an other things.
So, have not had much free time to assist people here. Hope to get back to it soon…

Sponsor our Newsletter | Privacy Policy | Terms of Service