• Resolved blueberry25

    (@blueberry25)


    Hi,
    I`m trying to overwrite the main.css with the child theme @import rule without any success. In <em>skt-full-width-child folder</em> I created the <em>main.css</em> file:
    ‘/*
    Theme Name: SKT Full Width Child
    Template: skt-full-width
    Version: 1.0.0
    */

    @import url(“../skt-full-width/css/main.css”);’

    Im developing the website locally so I cant put here the link for now.
    Many thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author sonalsinha21

    (@sonalsinha21)

    Sorry i am bad with child themes.

    Not sure if i can be of much help to you.

    I will try to take help from someone and try to create one child theme this month and let you know.

    As of know use the parent theme please.

    And you can upgrade the version via style.css to something like version 100 to avoid future updates to the theme.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If the main.css styles are loading already then you don’t need to @import them in again. Just override the styles in your Child Theme style.css file. I’m not sure what the issue is.

    Thread Starter blueberry25

    (@blueberry25)

    Many thanks guys!
    I`m not an expert but it the WordPress is telling me that using a Child Theme is the best practice I would prefer to stick to that ??
    I do need an @import rule to bothe style.css and main.css of the Parent Theme to override the Child Theme. Otherwise nothing will happen.
    I found some code on the net to put it in the functions.php of the Child Theme and it works but Im not sure if its correct:
    (source: <a href=”https://support.forcg.com/topic/child-css-module”>https://support.forcg.com/topic/child-css-module</a&gt;)

    <?php
    function skt_remove_scripts() {
        wp_dequeue_style( 'skt_full_width-main-style', get_template_directory_uri()."/css/main.css", array('skt_full_width-layout') );
        wp_deregister_style( 'skt_full_width-main-style', get_template_directory_uri()."/css/main.css", array('skt_full_width-layout') );
        wp_dequeue_style( 'skt_full_width-main-style', get_template_directory_uri()."/style.css", array('skt_full_width-layout') );
        wp_deregister_style( 'skt_full_width-main-style', get_template_directory_uri()."/style.css", array('skt_full_width-layout') );
        wp_enqueue_style( 'skt_full_width-main-style', get_stylesheet_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'skt_remove_scripts', 20 );
    ?>

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