• Ok so thanks in advance for anyone who tries to help, ive made child themes before that work fine but this theme is making me bang my head against the wall.

    So im making a child theme for my Oxygen theme.

    The issue im running into is calling both the style.css and the style.min.css I think I have it right and when I edit the child theme nothing seems to change…

    Should I be calling both style sheets for editing this theme?

    What would the code look like for calling both style sheets using the functions.php

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
    function enqueue_child_theme_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style')  );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • If you want an easy solution 2 steps

    1. use this plug-in to create a child theme https://wordpress.org/plugins/child-theme-configurator/ – it’s pretty straightforward to use – you can copy whatever files you want to be able to edit into the child theme easily. It also creates a functions file that you can add functions too and you will add a function in step 2.

    2. Add this to your child theme functions file

    add_action( 'wp_enqueue_scripts', 'load_my_child_styles', 20 );
    function load_my_child_styles() {
    wp_enqueue_style( 'child-theme', get_stylesheet_uri() );
    }

    don’t forget to close the php tag on your childs functions php

    Hope that works for you.

    Hi, I succesfuly made the oxygen child theme and for me, only one of both theme’s CSS stylesheets is enough to load.
    My theme loads ONLY style.min.css and it works fine.

    The PHP you’ve published comes from WordPress codex and does just this (visible in sourcecode here: http://www.skidestne.cz):

    <link rel='stylesheet' id='parent-style-css'  href='http://www.skidestne.cz/wp-content/themes/oxygen/style.min.css?ver=4.1' type='text/css' media='all' />
    <link rel='stylesheet' id='child-style-css'  href='http://www.skidestne.cz/wp-content/themes/oxygen-child/style.min.css?ver=4.1' type='text/css' media='all' />

    Loads original style.min.css AND AFTER it the style.min.css FROM THE CHILD.
    It causes that your changes are read AFTER and rewrite the original template’s CSS file.

    If you can make only some CSS changes, the Oxygen theme has Own css field in Look setup – there, if it is not working/rewriting the original css rules, USE !important declaration, which has the highest priority and is always executed, eg:
    main-header {color: red !important;}

    In my opinion – style.css is not compressed (means with white spaces and better formatting) and style.min.css is the same but pusshed into “one line” because of filesize = pageload time reduction.

    Regards
    Alois

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

The topic ‘style.css and style.min.css child theme ISSUES!’ is closed to new replies.