Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

1.5 Child Theme Not Working (17 posts)

Started 8 months, 2 weeks ago by: alanchrishughes

  • Profile picture of alanchrishughes alanchrishughes said 8 months, 2 weeks ago:

    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.

  • Profile picture of @mercime @mercime said 8 months, 2 weeks ago:

    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

  • Profile picture of Boone Gorges Boone Gorges said 8 months, 2 weeks ago:

    @mercime ‘s method will work correctly. But, as of http://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.

  • Profile picture of alanchrishughes alanchrishughes said 8 months, 2 weeks ago:

    I am running whatever version was linked in the latest blog post.

  • Profile picture of alanchrishughes alanchrishughes said 8 months, 2 weeks ago:

    … for 1.5, not the 1.2 update.

  • Profile picture of alanchrishughes alanchrishughes said 8 months, 2 weeks ago:

    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.

  • Profile picture of Boone Gorges Boone Gorges said 8 months, 2 weeks ago:

    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

  • Profile picture of alanchrishughes alanchrishughes said 8 months ago:

    @boonebgorges child themes still don’t work with 1.5

  • Profile picture of alanchrishughes alanchrishughes said 8 months ago:

    And even using the template pack there is so much theme inside the plugin you have to “hack” it.

  • Profile picture of Boone Gorges Boone Gorges said 8 months ago:

    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.

  • Profile picture of alanchrishughes alanchrishughes said 8 months ago:

    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.css

    The font size never changed, I tried adding a background image, nothing….

  • Profile picture of tedace tedace said 8 months ago:

    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.

  • Profile picture of naijaping naijaping said 7 months, 3 weeks ago:

    @mercime, your code is not working for my child theme, i dont know why. it just dont recognise my child theme custom style.css.

  • Profile picture of r-a-y r-a-y said 7 months, 3 weeks ago:

    I have recently updated the child theme codex article for BP 1.5:

    http://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/

    Give it a read through and see if that helps.

  • Profile picture of @mercime @mercime said 7 months, 3 weeks ago:

    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.