• Hi guys,

    I need help with my child theme activation and editing files.
    Im doing something wrong but I cant figure what is it…

    So I created local business-child in themes folder using filezila. And then created css.file with code that U can see on my uploaded picture at the bootom of this post. After that I went to my WP admin panel and activate that child theme.
    But problem is when I tried to edit css file of child theme, as U can also see on my uploaded picture, its not working… Nothing changed on website..

    http://postimg.org/image/crm0608i3/

    Pls help.. Im in WP just a few days, so I’m newbie 🙂

    Thx.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Can you post a link to your site?

    Hi there!

    Is that a screenshot of your child themes’ style.css?

    If so, it looks like you just copied the header information from the parent themes stylesheet. You need to put your own info in there:

    See here for a template of what you need at the top of your child theme’s style.css file.

    Also, WordPress now recommends enqueuing the stylesheet in your functions.php file rather than using the @import rule.

    There is also a video-tutorial here you might find useful.

    I hope that helps!

    Luke the Daft Duke

    Thread Starter qubanac87

    (@qubanac87)

    Here’s link to my website http://www.radanovicplast.rs/

    Is there any advantage using enqueuing the stylesheet in functions.php instead of import rule?
    Since I find it easier to edit my css files in that .css file rather then in function.php since im not too good with php.

    Thx for suggestions.

    I will try to edit that header of css file and then try again.

    Is your child theme currently active? I don’t see it on your site.

    As for using @import, it’s no longer recommended because it’s slower (sometimes significantly so) in most cases. But you don’t have to worry about editing PHP, because regardless of how you import the parent theme’s stylesheet, it doesn’t change how you edit your child theme’s stylesheet.

    Thread Starter qubanac87

    (@qubanac87)

    @stephen ahh great, I will try to import with functions.php.

    I disabled child theme, since my .css file is not working and I saw that content of pages, except home page, are scattered. Don’t know why but I will try first to edit header of .css and to import it with function.php, and then to enable child theme.

    Thread Starter qubanac87

    (@qubanac87)

    I just updated couple of things and tested your advices.

    Now my stylesheet is import with functions.php and I edited header of .css file. After that I had activated child theme and its working, all pages are ok.

    But still when I try to edit my child theme css, its not changing anything on web site :/
    I tried to change same stuff in parent css file and its working..

    Here are SS’s of present condition.

    http://postimg.org/image/94tvwezuh/

    http://postimg.org/image/gv5guor7z/

    Because of the way your theme is set up, the child theme’s stylesheet is loaded first, and then the parent theme’s stylesheet. Because the parent theme’s stylesheet is loaded last, the styles within that stylesheet “win”. To fix this, you’ll have to make a little change to the code in your functions.php. Instead of the code you have, use this code instead:

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

    This code will make sure the stylesheets are loaded in the correct order.

    Also, using this code with your theme will cause the child theme’s stylesheet to be loaded twice. It won’t cause any problems, but for completeness’ sake, you can stop that behavior by copying the parent theme’s header.php to your child theme’s folder and then deleting this line from the child theme’s copy:

    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />

    Thread Starter qubanac87

    (@qubanac87)

    Wow man, U are really helpful 🙂

    U fix it all, now its working perfect. Thx a lot !!

    One more thing, why is the name of my child theme local-business instead of local business-child.. In themes names I have two local business themes… Name of my child theme folder is local-business-child and parent folder is local-business… All through filezila.

    http://i60.tinypic.com/347z34k.jpg

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    That’s your choice, there are no rules for child theme names

    Thread Starter qubanac87

    (@qubanac87)

    Yeah man, but my folder name is -child.. And when I go through wp panel, my theme name is same as parent theme name.. No “child” word in it :/
    I know that doesnt matter for editing or working in wordpress, but I wanna know why it’s not named properly like I want it to be.

    Great customer support for my Local Business theme by InkThemes team. You guys rocked… Just reach them at http://www.inkthemes.com/lets-connect/ mentioning the issues properly and you will receive the perfect solution.

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

The topic ‘Activating child theme and editing css file’ is closed to new replies.