Child Theme without @import (2016 good practice)

  • Posted in : cvCard WP
  • Shenandoa
    Participant

    Hello (and sorry for my english),

    To create my child theme correctly, WordPress recommands to create style.css and functions.php in the child theme, without the @import (not a good practice from now).

    For one .css file, the code to insert in function.php (child) is :

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

    }

    (source of the code : https://codex.wordpress.org/fr:Thèmes_Enfant)
    (English version : https://codex.wordpress.org/Child_Themes)

    But in the cvcard theme there are many .css files. (I see 1 folder with many .css files + 1 custom-editor-style.css). WordPress recommands to : "If your theme is more than one css file (for example ie.css , style.css , main.css ) then you should make sure to keep all the dependencies of parent theme. Configure ' parent style ' as a dependency ensure that shipments of child's theme style sheets is done after."

    Could you help me to code that functions.php file for the child theme or nicely give me the zip child theme 2016 version (without @import) ?

    Thank you so much.

    serkan
    Moderator

    Hi Shenandoa,
    I forwarded this issue to the WordPress developer. He will get back to you soon. Thanks for your patience.

    Mehmet S.
    Keymaster

    Hi, you can enqueue the parent style.css file inside the functions.php file of your child theme as suggested in the codex page.

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register