• Resolved seancli

    (@seancli)


    Hi all,

    I’ve tried to make child themes of several themes, but I must be doing something fundamentally wrong for none of them to work (even twentyfourteen). Here’s my site:

    http://86h.seancli.com/ – My site, set as my Moesia child. It’s a newly installed WordPress, just deleted the default posts/comments

    https://wordpress.org/themes/moesia/preview/ – preview/download Moesia

    I’m also trying to do the same for my main site, http://www.seancli.com. I’m having the same problem.

    All help is greatly appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • WPyogi

    (@wpyogi)

    What do you have in the style.css file? This shows up with strange characters in the @import line:

    @import url(‘../moesia/style.css’);

    BTW, using @import is no longer considered best practice for a child theme – see:

    http://codex.wordpress.org/Child_Themes

    Thread Starter seancli

    (@seancli)

    Ah those are (‘) instead of (“). Both got me the same results but to be proper I’ll change it back

    Also I read about @import not being the best anymore, I just did it because it seemed simpler. I’ll start reading about the other way more in depth. Thanks!

    Thread Starter seancli

    (@seancli)

    Updated below

    Thread Starter seancli

    (@seancli)

    So I removed the @import line from style.css, created functions.php in the same folder, and entered this:

    <? php
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        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')
        );
    }
    
    ?>

    But now I have a syntax error.

    WPyogi

    (@wpyogi)

    Try this in the functions.php file:

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

    Don’t use a closing PHP tag – it’s no longer considered best practice.

    Thread Starter seancli

    (@seancli)

    Worked! Thanks so much!!

    WPyogi

    (@wpyogi)

    Oh cool :)! Glad to hear it and you’re welcome!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Child Theme Help’ is closed to new replies.