Viewing 4 replies - 1 through 4 (of 4 total)
  • Use a child theme, and enqueue the stylesheets you need through the child theme’s functions.php file.

    It’s possible a theme or plugin is already loading FontAwesome, so check for that first. It’s pretty common.

    Thread Starter johnatanasoff

    (@johnatanasoff)

    @kjodle Thanks for your help!

    I followed this tutorial:
    https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/#what-are-child-themes-and-why-use-them

    As functions.php is likely not well configured, placing css code in style.css does nothing, so i currently got the extra css again in “Additional CSS” and the same error appears of course.

    With functions.php properly configured it should be pulling the css from style.css in onetone_child theme folder right?

    I am totally new to php. This is the code i have if you are able to point me to the right direction:

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    
    • This reply was modified 7 years, 2 months ago by johnatanasoff.

    That tutorial is incorrect, because it fails to enqueue the child theme stylesheets as well. You need to enqueue both the parent and child stylesheets.

    <?php
    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
    
        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 ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    

    That example, which enqueues both the parent and child theme stylesheets is from the Codex: https://codex.www.ads-software.com/Child_Themes#How_to_Create_a_Child_Theme

    Thread Starter johnatanasoff

    (@johnatanasoff)

    @kjodle Will analyse and report back!

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘@import not allowed in Additional CSS’ is closed to new replies.