1.5 Child Theme Not Working
-
I’ve never tried creating a child theme before but I was checking out 1.5 last night and followed this tutorial on making one http://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/
I created a new folder in my regular WordPress themes folder titled “Buddypress Child” and create a new stylesheet with this at the top
/*
Theme Name: BuddyPress Child
Template: bp-default
Tags: buddypress
*/It shows up in the back-end and I select it as my theme, but any styles I set with it are just ignored.
-
BP 1.5 now enqueues all stylesheets in functions.php. Therefore, to create your child theme, either remove the enqueueing by creating a new functions.php in child theme folder and adding this:
`<?php
if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
function bp_dtheme_enqueue_styles() {}
endif;
?>`You could also opt to enqueue your child theme’s style.css by overriding bp-default’s pluggable function bp_dtheme_enqueue_styles with your own
`if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
function bp_dtheme_enqueue_styles() {
// Bump this when changes are made to bust cache
$version = ‘20110930’;
// Register our main stylesheet
wp_register_style( ‘mychildtheme-style’, get_stylesheet_directory_uri() . ‘/_inc/css/screen.css’, array(), $version );
// Enqueue our main stylesheet
wp_enqueue_style( ‘mychildtheme-style’ );
}
}
add_action( ‘wp_print_styles’, ‘bp_dtheme_enqueue_styles’ );
endif; `If you’ve named your stylesheet, screen.css, then change /_inc/css/default.css above to /_inc/css/screen.css above
@mercime ‘s method will work correctly. But, as of https://buddypress.trac.wordpress.org/changeset/5124, it shouldn’t be necessary. The method that @alanchrishughes suggests should work properly. Please ensure that you’re running 1.5-rc-1, or an svn checkout of at least r5124.
I am running whatever version was linked in the latest blog post.
… for 1.5, not the 1.2 update.
Personal activity streams don’t seem to be working either if you are using the template pack.
PS: The personal activity streams on buddypress.org doesn’t seem to be working anymore either and all the old activity is completely wiped out.
The current stable version of the template pack has not been verified as compatible with BP 1.5. You can get the dev version from https://github.com/boonebgorges/bp-template-pack
@boonebgorges child themes still don’t work with 1.5
And even using the template pack there is so much theme inside the plugin you have to “hack” it.
You’ll have to provide more details. Child themes work in all my tests, and in all the tests that have been run by those participating in development on Trac.
For instance, this minimal child theme works as expected:
`/*
Theme Name: BP Child
Tags: buddypress
Template: bp-default
*/body {
font-size: 30pt;
}`That’s the content of wp-content/themes/style.css.
I’m also not exactly sure what you mean by the last part, about the template pack. The plugin itself really doesn’t contain much “theme” at all. It copies templates, and loads javascript, directly from bp-default.
All of the details are in this thread. I created a new folder in my themes folder, named it BP Child, copy and pasted what you have there to a style sheet named style.css inside of the them folder and directly in the root of the themes folder because I wasn’t sure if you just made a typo or not forgetting the theme name folder there
wp-content/themes/style.css
wp-content/themes/BP Child/style.cssThe font size never changed, I tried adding a background image, nothing….
its working for me.
/*
Theme Name: BP Child
Tags: buddypress
Template: bp-default
*/body {
font-size: 30pt;
}
That’s the content of wp-content/themes/style.css.@mercime, your code is not working for my child theme, i dont know why. it just dont recognise my child theme custom style.css.
@mercime, your code is not working for my child theme, i dont know why. it just dont recognise my child theme custom style.css.
I have recently updated the child theme codex article for BP 1.5:
https://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/Give it a read through and see if that helps.
I have recently updated the child theme codex article for BP 1.5:
https://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/Give it a read through and see if that helps.
Thank you @r-a-y Bravo!
@naijaping Which of the two codes above didn’t work for you? Both codes prevent bp-default’s stylesheet from being enqueued in wp_head. I may not have explained it more thoroughly above.
The first code – write all your custom styles in style.css of child theme or @import style from e.g. a css folder within your child theme’s folder and get the layout you want without interference.
The second code – child theme’s style.css file only has the header portion i.e. theme name, author, etc. but no styles or @import since stylesheet is enqueued in child theme’s functions.php file. I edited second code above to register the stylesheet before enqueueing.
Thank you @r-a-y Bravo!
@naijaping Which of the two codes above didn’t work for you? Both codes prevent bp-default’s stylesheet from being enqueued in wp_head. I may not have explained it more thoroughly above.
The first code – write all your custom styles in style.css of child theme or @import style from e.g. a css folder within your child theme’s folder and get the layout you want without interference.
The second code – child theme’s style.css file only has the header portion i.e. theme name, author, etc. but no styles or @import since stylesheet is enqueued in child theme’s functions.php file. I edited second code above to register the stylesheet before enqueueing.
Can someone clear this up for me?
Do I need to muck about with the function that enqueues the CSS if all I want to do is tweak the CSS and leave the default.css to handle the things I’m not touching? The tutorial says no, but reading the comments here I’m no longer certain.
One thing I do know though is that my custom styles (in wp-content/themes/themename/styles.css along with the required information) are not overriding the defaults. They do on the home page but not on the activity stream.
You can see the results here: http://platoon13.org/news
No if you’re using BP and just creating a child theme for purposes of overriding a few styles then BP will enqueue your child themes style.css file so all you should need to do is add your rulesets in there
If they are not getting applied you may not be adding sufficient weight to your selectors examine the BP rules to see the selector grouping and match or increase the selectors i.e ‘ul#groups-list li .item-meta {}’
I’m using the exact same selectors from default.css I simply copied them all over and removed the styling. I only add styles to those elements I want to change. The Home page works fine I can change any style I like on there but none of the sub-pages (activity, forums, users) are taking my styling at all.
Edit: I’ve tried what you suggested, making the selectors as specific as possible (or as is sensible), without success. Surely any styles which I set will take precedence over those in default.css as my stylesheet is the one that is loaded last?
I also forgot to point you at my site: http://platoon13.org/news/ Have a poke around, you may see something that I’ve missed.
I found the issue. I was missing a ‘}’ *facepalm* Thanks for the help anyway.
/me now retreats to a cave to spend his life in solitary repentance
- The topic ‘1.5 Child Theme Not Working’ is closed to new replies.