wordpress中的儿童主题网址

use*_*610 11 wordpress

我想在wordpress中创建一个网站,为此我采取主题并创建一个儿童主题.

我在子文件夹中复制了一个style.css和header.php,因为我也想修改标题.我修改了孩子的文件.

在我的style.css中,我添加了Template:行,其中包含父主题的名称

/*
Theme Name: Example
Theme URI: http://www.woothemes.com/
Version: 1.2.15
Description: Designed by <a href="http://www.woothemes.com">WooThemes</a>.
Author: WooThemes
Author URI: http://www.woothemes.com
Tags: woothemes
Template: mystile

  Copyright: (c) 2009-2011 WooThemes.
  License: GNU General Public License v2.0
  License URI: http://www.gnu.org/licenses/gpl-2.0.html

*/
Run Code Online (Sandbox Code Playgroud)

我在header.php中使用这一行

<?php $logo = esc_url( get_template_directory_uri() . 'images/logo.png' ); ?> 
Run Code Online (Sandbox Code Playgroud)

我的孩子主题采取图像,但这行返回父亲主题的网址没有他的孩子!

我接受了.

http://localhost/.../wp-content/themes/mystile/images/...
Run Code Online (Sandbox Code Playgroud)

我想要这个

http://localhost/.../wp-content/themes/example/images...
Run Code Online (Sandbox Code Playgroud)

任何的想法

bra*_*ilo 31

您需要get_stylesheet_directory_uri,此函数首先在子主题目录中检查,然后在父主目录中检查.您正在使用的那个只检查父目录.

底线:如果某个功能的行为不符合您的预期,请检查Codex.很可能你会发现为什么那边.