• I made a child theme

    since the original css is empty and styles are enqueued from the functions.php file in the parent theme (coeur), when I add mon own styles in the child theme’s style.css file, they don’t work….

    here is my test child’s style.css

    /*
    Theme Name:     Coeur Child
    Theme URI:      https://example.com/
    Description:    Thème enfant pour le thème Coeur
    Author:         Votre nom ici
    Author URI:     https://example.com/about/
    Template:       coeur
    Version:        0.1.0
    */
    
    a  { color:red!important;  }  
    
    span.toto  {  color:#f00;  }
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @wp-lionel. I have a solution but it is not a nice one. I have also strugled with creating child theme but no luck. I guess it is not working because @import url(“../coeur/style.css”); is not working. This is because the style sheets are called within functions.php.
    So what I did is in the original theme modify functions.php.
    Beneath line 87 I added the following:
    wp_enqueue_style('mystyles', get_template_directory_uri() . "/framework/css/mystyles.css", array(), '0.1', 'screen');

    Also I created in /framework/css/ the file mystyles.css and added the css styles.

    Thread Starter wp-lionel

    (@wp-lionel)

    Thanks, but what happen’s if the theme is updated?

    maybe it can exist a solution with a plugin wich just load the stylesheet?

    but how to choose the correct hook toad the stylesheet on?

    Indeed… that’s a problem. Therefore this is definitely not a nice solution from me ?? but I couldn’t find another one.

    Thread Starter wp-lionel

    (@wp-lionel)

    I’ve found a solution as not making child theme, by addind a line like
    <?php include (TEMPLATEPATH . ‘/my_header_include.php’); ?>
    in the header.php, just before the </head> tag (and after the wp_head() tag)
    in the included file I put a link like
    <link rel=”stylesheet” type=”text/css” href=”<?php echo get_template_directory_uri(); ?>/framework/css/perso.css” />

    The perso.css styles are loaded at the end and I can put in it my additionnal styles.

    O.k. @wp-lionel but are these changes in the original theme?
    Or do you create child-theme with a modified header.php and subdir framework/css and style.css?

    Thread Starter wp-lionel

    (@wp-lionel)

    No, just in the original theme, and the only constraint in this case is to put back the line in the header.php if you ever update the theme.

    O.k. another approach. To bad creating a real child theme is not possible it seems to.

    I managed to create a child theme by adding a custom css with wp_enqueue_scripts in my child theme functions.php. Working great.

    @giellemme, can you explain more how you did that?

    Yeah — wondering the same thing —?what’s the proper way to do a child theme with Couer? I didn’t have any luck in my last attempt, and just installed 3.0 on a new client’s site, and was hoping to figure it out this time.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘no custom styles with child theme ?’ is closed to new replies.