Skip to:
Content
Pages
Categories
Search
Top
Bottom

Struggling with child themes

  • Apologies if this has been answered already – can’t seem to find a way to search these forums.

    I have read on this site how to create a child theme – simple apparently.

    I have a child theme, activated, with just a css file – this should override the default file. Making simple changes to this, either breaks the theme (tried to change the sidebar width – just made a mess of the page layout) – or, it just does nothing at all.

    Are there any up to date tutorials that deal with 1.5 specifically or am I to struggle with this.

    Like the look of buddyPress but it appears very difficult to create anything outside the standard template. Makes it rather redundant. I am experienced with css and have built a number of WordPress sites. I have also used Drupal, which currently seems a better bet – at least I can create a template without it falling apart.

    Don’t mean to moan, just rather disappointed.

    Cheers!

    Mike

Viewing 5 replies - 1 through 5 (of 5 total)

  • modemlooper
    Moderator

    @modemlooper

    BuddyPress still loads the core CSS you are better off creating a functions.php file in your child theme folder and enqueueing a custom.css file

    `function add_my_stylesheet() {
    wp_enqueue_style(‘custom’, get_bloginfo(‘stylesheet_directory’) . ‘/custom.css’);
    }
    add_action(‘wp_enqueue_style’, ‘add_my_stylesheet’);`

    Hi,

    Many thanks for that.

    I’ve copied the default Buddypress functions.php and added the above code. This just results in the site not loading.

    From the various articles i have read it would appear that copying the original files from BP-default such as header.php, footer.php etc to the child themes folder and editing them is meant to work. So far, if I make any changes to them it just breaks BuddyPress.

    I must be missing something here.

    Cheers,

    Mike


    modemlooper
    Moderator

    @modemlooper

    No, do not copy. Create a blank functions.php file and add your own custom functions.

    Hi,

    Thanks for that.

    My stylesheet is called style.css so my functions.php contains the following:

    `<?php

    /*enqueue stlyesheet – ADDED BY MIKE*/

    function add_my_stylesheet() {
    wp_enqueue_style(‘style’, get_bloginfo(‘stylesheet_directory’) . ‘/style.css’);
    }
    add_action(‘wp_enqueue_style’, ‘add_my_stylesheet’);

    /*MIKE’S EDIT ENDED */

    ?>`

    Am I getting there?

    Cheers,

    Mike


    @mercime
    Keymaster

    @mercime

    @wmike1503 wrap your code with backticks (`), the symbol between the parentheses so your code will show up here. I’ve done it for you in your post above.

    I’ve just updated codex re child themes some hours ago for BP 1.5.2 https://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/ so you might have missed the changes required.

    1. If you want to make some minor changes, create your child theme folder, create style.css file for your child theme and remember to add Template: bp-default in the header of your stylesheet. Then just start adding in your style changes in style.css file and you’re good to go.

    2. If you want a total redesign, you’d need to create a functions.php file as well. You want to remove parent theme’s styles and enqueue your own style (alternative method in updated codex article):
    `<?php
    if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
    function bp_dtheme_enqueue_styles() {
    // You should bump this version when changes are made to bust cache
    $version = ‘20111223’;
    // Register stylesheet of wmike child theme
    wp_register_style( ‘wmike’, get_stylesheet_directory_uri() . ‘/style.css’, array(), $version );
    // Enqueue stylesheet of wmike chid theme
    wp_enqueue_style( ‘wmike’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘bp_dtheme_enqueue_styles’ );
    endif;
    ?>`

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Struggling with child themes’ is closed to new replies.
Skip to toolbar