• Resolved Redyan

    (@redyan)


    Hi all,
    unfortunately for me the problem is not solved. Child Theme Configurator creates conflict and it is not good for me. I created a folder called coeur-child, a style.css and a functions.php. Inside the functions.php there’s the classic enqueue:

    <? Php
    
    add_action ('wp_enqueue_scripts', 'enqueue_parent_theme_style');
    
    enqueue_parent_theme_style function () {
    ????wp_enqueue_style ('parent-style', get_template_directory_uri (). '/style.css');
    }

    The coeur style.css is empty because the template is configured this way:

    <? Php
    / **
    ?* Coeur functions
    ?*
    ?*package Coeur
    ?*author Frenchtastic.eu
    ?* /
    
    // Setup
    get_template_directory require_once (). '/framework/functions/setup.php';
    
    // Styles and Scripts
    get_template_directory require_once (). '/framework/functions/scripts.php';
    get_template_directory require_once (). '/framework/functions/styles.php';
    
    // Includes Coeur
    get_template_directory require_once (). '/framework/functions/template-tags.php';
    get_template_directory require_once (). '/framework/functions/sidebars.php';
    get_template_directory require_once (). '/framework/customizer/customizer.php';
    get_template_directory require_once (). '/framework/customizer/sanitize.php';
    get_template_directory require_once (). '/framework/classes/comments.php';
    get_template_directory require_once (). '/framework/classes/wp_bootstrap_navwalker.php';

    The CSS that is applied in case of Classic theme is /framework/css/blog.css.

    Now the style.css in the child is not managed; the only way to obtain a result is to use an import within the blog.css.

    Maybe I’m wrong .. I tried but I could not
    Is there a way to manage Coeur with a child?

    Thank, thank and again thank

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Redyan

    (@redyan)

    Ok I solved.

    in “coeur-child/functions.php”

    child_theme_styles function () {
    wp_dequeue_style ('parent-theme-style');
    wp_enqueue_style ('child-theme-style', get_stylesheet_uri ());
    }
    add_action ('wp_enqueue_scripts', 'child_theme_styles');

    If You need to add google-font the complete “coeur-child/functions.php” would be like this:

    <?php
    function child_theme_styles() {
    	wp_dequeue_style( 'parent-theme-style' );
    	wp_enqueue_style( 'child-theme-style', get_stylesheet_uri() );
    }
    add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
    
    function wpb_add_google_fonts() {
        wp_register_style('wpb-googleFonts', 'https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300&subset=latin,latin-ext');
        wp_enqueue_style('wpb-googleFonts');
    }
    add_action('wp_print_styles', 'wpb_add_google_fonts');

    There might be in some themes where the child theme stylesheet will load before parent theme style sheet. Those themes will have the code like this in the “coeur-child/header.php”:

    <?php wp_enqueue_style( 'parent-theme-style', get_stylesheet_uri(), false, '2.0' ); ?>
    <?php wp_head(); ?>

    This is the source:
    https://ulrich.pogson.ch/how-to-load-the-parent-styles-in-child-themes

    This helped me, thanks. I feel like another child theme generator plugin I used on another site worked fine, the one I tried just now did not but the above code quickly fixed the issue.

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