url of child theme in wordpress

后端 未结 2 1752
栀梦
栀梦 2021-01-04 12:08

I want to create a website in wordpress, for this I take a theme and create a child theme.

I copy in the folder of the child a style.css and header.php, because I w

相关标签:
2条回答
  • 2021-01-04 12:35

    You need get_stylesheet_directory_uri, this function checks first in the child theme directory and then in the parent's. The one you're using only checks in the parent directory.

    Bottom line: if a function doesn't behave as you expect, check the Codex. Much probably you'll find out why over there.

    0 讨论(0)
  • 2021-01-04 12:49

    Add to functions.php:

    // create a URL to the child theme
    function get_template_directory_child() {
        $directory_template = get_template_directory_uri(); 
        $directory_child = str_replace('storefront', '', $directory_template) . 'child-storefront';
    
        return $directory_child;
    }
    
    0 讨论(0)
提交回复
热议问题