我想加载一些特定的css来更改WP首页/主页的主体元素的颜色。在我的主题函数文件中,以下代码似乎有效,但有人能告诉我它是否“正确”吗?
//Adding and Encuing styles for Front Page
add_action( \'template_redirect\', \'front_page_design\' );
function front_page_design(){
if ( is_front_page() || is_home()) {
add_action(\'wp_enqueue_scripts\', \'enqueue_index_styles\');
function enqueue_index_styles() {
wp_register_style( \'home_page_style\', get_stylesheet_directory_uri() . \'/index-style.css\' );
wp_enqueue_style( \'home_page_style\' );
}
}
}
我遇到了一个blog by Mark Jaquith 说template\\u include是为了包含,这就是我正在做的,对吗?