0

I have little experience with creating a Child Theme. Just want to make some changes to css on the website.

When I use the inspect mode to see which CSS was being used, I saw it was still linking to the parent css. Do I have the right code for my functions.php?

function.php

0

The get_template_directory_uri() function returns the URL to the root theme.

If a child theme is used and you want to return the URL to the current child theme, use get_stylesheet_directory_uri() instead.

https://developer.wordpress.org/reference/functions/get_stylesheet_directory_uri/

  • Thank you for your comment. I have replaced 'get_template_directory_uri()' with 'get_stylesheet_directory_uri()' but that didn't work. – Stefka Waaijer Nov 9 '17 at 15:59
  • Sorry. the source code through the link I didn't understand. Do I have to place it somewhere as well? – Stefka Waaijer Nov 9 '17 at 16:05
  • Hi you need to simply change get_template_directory_uri to get_stylesheet_directory_uri in your code. – LumberHack Nov 10 '17 at 10:56
0

There is something to be added in the top of style.css (child) file. Have you written it ? If yes then ignore it. if not you will have to add these following lines.

/*
 Theme Name:   Theme Child   
 Description:  about_your_child_theme
 Author:       your_name
 Template:     name_of_your_parent_theme
 Version:      1.0.0
*/

The first and 4th one are so important (Theme name and Template). Make sure your Template name and parent theme are same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.