• I’ve attempted to create a child theme to do some basic customisations to this theme.
    No problems overwriting/changing elements such as footer.php to suit.
    However something appears strange in terms of the .css and no matter what I do – including large-scale modifications to

    brawny-child/sytle.css
    or
    brawny-child/css/lightpurple.css

    I thought it worth checking if the theme is designed or is okay to support a child theme’s css modifications. So far I’m thinking not ?

    Any assistance appreciated.
    -James

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter feelsickened

    (@feelsickened)

    appears the brawny/includes/enqueue.php file is adding the parent .css again after calling the child css. Couldn’t circumnavigate this without hacking away at the original theme files unfortunately.

    Shame – it’s a very nice big and clear theme.

    Hello
    Open functions.php in your child theme and add following code

    function wpdocs_theme_name_scripts() {
        wp_enqueue_style( 'child-style-name', get_stylesheet_uri(), 'brawny-style' );
    
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

    and then edit style.css inside your child theme folder to have a test. Hope this will work.
    Also try replacing brawny-style with style id which comes after child theme style css.

    I’ve attempted to create a child theme to do some basic customisations to this theme.

    Did you read: Child Themes ? WordPress Codex?

    No problems overwriting/changing elements such as footer.php to suit.

    Are these changes to the main theme – Brawny? If so, when the theme updates, all changes will be lost.

    However something appears strange in terms of the .css and no matter what I do – including large-scale modifications to

    For a Child Theme you need at least a style.css and a functions.php.
    Did you put a header at the top of your child theme that looks similar to this:
    (this one is for the Twenty Fifteen Theme, not yours)

    /*
     Theme Name:   Twenty Fifteen Child
     Theme URI:    https://example.com/twenty-fifteen-child/
     Description:  Twenty Fifteen Child Theme
     Author:       John Doe
     Author URI:   https://example.com
     Template:     twentyfifteen
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  https://www.gnu.org/licenses/gpl-2.0.html
     Tags:         light, dark, responsive-layout, accessibility-ready
     Text Domain:  twenty-fifteen-child
    */

    Did you enqueue your Child theme style.css and your Parent theme (Brawny) style.css by putting code in your functions.php file that looks similar to this (some parts of this you will have to enter parent and child names)…

    <?php
    
    function theme_enqueue_styles() {
    
        $parent_style = 'parent-style';
    
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style )
        );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

    …with no spaces before or after it?

    Thread Starter feelsickened

    (@feelsickened)

    Thanks for the responses guys.
    The nut to crack will be getting my child theme’s function to overwrite/replace the parent themes enqueue.php file / get_theme_mod function…….

    If you check the <head> produced by the theme with a basic child theme in place (following the codex) – you’ll identify the issue with the css as coming from the parent enqueue.php file. It is putting into the <head> another stylesheet (referred to as brawny-blue – no matter what colour option you picked in customising the theme, AFTER the child theme’s css.

    switch ( get_theme_mod(‘color’ ) ) {
    case ‘1’:
    wp_enqueue_style( ‘brawny-blue’, BRAWNY_PARENT_URL . ‘/css/default.css’);
    break;
    case ‘2’:
    wp_enqueue_style( ‘brawny-blue’, BRAWNY_PARENT_URL . ‘/css/lightpurple.css’);
    break;
    default:
    wp_enqueue_style( ‘brawny-blue’, BRAWNY_PARENT_URL . ‘/css/default.css’);
    break;
    }
    }

    if this wasn’t the case – a basic addon child theme’s css would work straight away by default. ??

    Take a look at this thread: https://www.ads-software.com/support/topic/feature-request-wp_enqueue_style-with-priorityload-order?replies=4 – the first answer by Jan Dembowski may pose a solution.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘child theme’ is closed to new replies.