• Resolved korywoodard

    (@korywoodard)


    trying to install a child theme to https://www.peanutmakesthree.com/ through the dashboard and not the FTP editor. it’s stripping the css from the parent theme (twenty twelve) even with this line:

    @import url("../twentytwelve/style.css");

    Is there something new that should be added in 3.6?

Viewing 14 replies - 1 through 14 (of 14 total)
  • You can’t install a child theme the via the dashboard.

    Thread Starter korywoodard

    (@korywoodard)

    That makes no sense?

    Your site is also not accessible, so hard to see what’s going on.

    You can’t create a new theme folder via the dashboard – do you already have that set up per:

    https://codex.www.ads-software.com/Child_Themes

    Thread Starter korywoodard

    (@korywoodard)

    You can upload a theme .zip folder via the dashboard, which is what I did. I have a header.php file and style.css. Is there something missing?

    Oh, okay, yes you can do that. So what is in the style.css file of the child theme?

    Thread Starter korywoodard

    (@korywoodard)

    /*
    Theme Name:     Peanut Makes Three
    Theme URI:      https://peanutmakesthree.com
    Description:    Personalized Twenty Twelve Child Theme
    Author:           Kory Woodard
    Author URI:     https://korywoodard.com/about/
    Template:       twentytwelve
    Version:        0.1.0
    */
    
    @import url("../twentytwelve/style.css");

    And this is what it looks like: https://tinypic.com/r/2lszko7/5

    What’s the name on the child theme folder and is it directly in the themes folder (next to twentytwelve)? Have you cleared your browser cache and any caching on your site?

    Thread Starter korywoodard

    (@korywoodard)

    This site is for a client of mine, and I don’t have access to her FTP. So, I’m honestly not sure. I did empty the browser cache with no help.

    If you uploaded it, did you not see what the name was on the folder in the zip? Or how was it created? Is there an unmodified twentytwelve theme in the themes?

    Also, if you modified the @import line after uploading the theme, try changing to another theme and then back to the child theme.

    Thread Starter korywoodard

    (@korywoodard)

    The zip folder is ‘peanut makes three.zip’

    Hi there. Have you managed to resolve this?

    It could be caused by problems with the relative path of your parent theme. i.e. your child theme can’t find the parent theme’s stylesheet. Probably due to hosting file locations.

    Rather than using “@import” in your child stylesheet, try enqueuing the parent theme stylesheet. This will ensure it is loaded at the right time.

    You can do this by editing the functions.php (backup first!). You don’t need ftp for this, you can either edit directly in appearance, or in your test environment, then zip everything.

    So in your case, try this code in your functions.php:

    /**
    * Enqueue parent and child theme stylesheets
    */
    define ('PARENT',get_template_directory_uri());
    define ('CHILD',get_stylesheet_directory_uri());
    
    function child_enqueue_scripts(){
    wp_register_style('parent-style',PARENT.'/style.css','','all');
    wp_register_style('child-style', CHILD.'/style.css','','all');
    
    wp_enqueue_style('parent-style');
    wp_enqueue_style('child-style');
    }
    add_action('wp_enqueue_scripts','child_enqueue_scripts');

    It seems like a lot to do, just to add a stylesheet, but it will help you do the following:
    1. You can now delete the @import line from your child theme css
    2. Remove any references to parent, or child theme css in your header.php
    3. Gives you a framework for enqueueing other scripts and styles, including javascript.

    You can read more about enqueuing scripts and styles here:
    https://codex.www.ads-software.com/Function_Reference/wp_enqueue_script

    Hope this helps.

    Thread Starter korywoodard

    (@korywoodard)

    That did it! Thanks so much!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘child theme not working’ is closed to new replies.