Wordpress not working get_template_directory_uri with a child theme

  • 5 years-11 months

    Wordpress not working get_template_directory_uri with a child theme

    • Category : wordpress
    • Viewed : 103 times
    • Posted On :
    • Posted by : Vikas

    How to get WordPress Child Theme Path.

    When you create a website in wordpress, for this and take a theme and create a child theme.
    Ex. Parent Theme: dorcode
    Child Theme: dorcode-child

    So copy in the folder of the child a style.css and header.php, because you want to modify the header too. you modify the file of the child.

    In my style.css you add the line Template: with the name of the father theme


    // add this function to function.php and replace with get_template_directory_uri() to get_template_directory_child().
    function get_template_directory_child() {
        $directory_template = get_template_directory_uri(); 
        $directory_child = $directory_template.'-child';
        return $directory_child;
    }
     

Report this or Ask your own question

Your Answer

When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.