2
是否可以根據您所在的類別顯示不同的主題?根據類別使用不同的WordPress主題
例如:
blog.example.com/category/foo -> style1.
blog.example.com/category/bar -> style2.
谷歌搜索帶來了this page,他建議在single.php中這樣做:
$post = $wp_query->post;
if (in_category(5)) {
include(TEMPLATEPATH . '/style1.php');
} else {
include(TEMPLATEPATH . '/style2.php');
}
這是要走的路?
謝謝約瑟夫,我非常感謝你的幫助! – dallen
@dallen - 當然。請注意,您鏈接到的文章早在2007年就有了,在Wordpress引入'get_template_part'函數之前。雖然'get_template_part'並不是全新的,我鏈接的文章在印刷機上很熱(今天早上)。絕對值得一讀。 –