创建子主题

时间:2015-07-07 02:56:11

标签: php wordpress themes

我正在尝试创建一个子主题,但我认为我的functions.php有问题。

(<?php)add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'sydney', get_template_directory_uri() . '/style.css' );

}function theme_enqueue_styles() {

$parent_style = 'sydney';

wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'sydney-child',
    get_stylesheet_directory_uri() . '/style.css',
    array( $parent_style )
);
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

1 个答案:

答案 0 :(得分:0)

可能是这个问题是由于您孩子主题中的function.php文件造成的。

首先加载子主题的functions.php意味着您可以创建主题可插入的用户功能 - 可以由子主题替换 - 通过限制性地提及它们。 E.g:

Record record = create.insertInto(CANDIDATE, CANDIDATE.FIRST_NAME,      
       CANDIDATE.LAST_NAME,CANDIDATE.EXTRACTED_NAME)
       .values("Charlotte", "Roche","Charlotte Roche")
       .returning(CANDIDATE.ID)
       .fetchOne();

System.out.println(record.getValue(CANDIDATE.ID));

通过这种方式,子主题可以通过简单地预先声明它来替换父级的PHP函数。

如需进一步参考,请访问:Wordpress Child Theme

如果您发现我的回答有用,请标记,以便其他人可以从中受益。

相关问题