• periodismetrespuntzero

    (@periodismetrespuntzero)


    Hi there!

    Apart from syle.css importing from the Parent theme, do I need any other file in my opulus-sombre-child directory, please?

    When I activate my Child theme, this doesn’t look ok and I would say that in the past (I have been reading a lot of threads about this) I saw somewhere that one or two other files had to be transferred to the child directory? Maybe functions.php or header.php?

    My website is https://www.cupricagency.com

    Thanks! Alexandra

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter periodismetrespuntzero

    (@periodismetrespuntzero)

    I think I managed by adding a functions.php file containing the following:

    <?php

    add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, PHP_INT_MAX);
    function enqueue_child_theme_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
    wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array(‘parent-style’) );
    }

    Can anyone confirm if this is the right thing to do please?

    stephencottontail

    (@stephencottontail)

    Is your child theme active now (11:23 am, Mountain time)? When I look at your site, everything seems to be in order. What specifically wasn’t working correctly when your child theme was active?

    Thread Starter periodismetrespuntzero

    (@periodismetrespuntzero)

    Hey,

    Right now (11:23) it’s active. The theme looks ok since I created that functions.php file in my child directory (please see my second post) that’s why I was asking if I had done ok or not (since in some threads people worry about the fact that you create a functions.php file on your child directory).

    Basically if I don’t include my functions.php the Child theme looks like a mess. Try visting my site now and you will see the difference… https://www.cupricagency.com

    Thanks! Alexandra

    stephencottontail

    (@stephencottontail)

    Ok, I understand now. What you did in the second post is the recommended way of creating child themes.

    What was happening with your child theme before was that you had this line commented out:

    /*
    @import url("../opulus-sombre/style.css");
    */

    In CSS, everything between /* */ is ignored by the browser. The @import line essentially does the same thing as what you did in the second post, but @import is a bit slower.

    So in conclusion, yes, you did everything correctly.

    Thread Starter periodismetrespuntzero

    (@periodismetrespuntzero)

    mmmm I didn’t change anything in the style.css the only thing I did is adding a functions.php file with the following text:

    <?php

    add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, PHP_INT_MAX);
    function enqueue_child_theme_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
    wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array(‘parent-style’) );
    }

    stephencottontail

    (@stephencottontail)

    I probably wasn’t clear with my last message. You should add your functions.php back to your child theme and continue to do what you were doing before.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child theme doesn't look like the Parent theme’ is closed to new replies.