傻大憨

wordpress子分类使用父分类模板

子分类使用父分类模板

 function f_category_template($template){
	$category = get_queried_object();
	if($category->parent !='0'){
		while($category->parent !='0'){
			$category = get_category($category->parent);
		}
	}
	
	$templates = array();
 
	if ( $category ) {
		$templates[] = "category-{$category->slug}.php";
		$templates[] = "category-{$category->term_id}.php";
	}
	$templates[] = 'category.php';
	return locate_template( $templates );
}
Published
Categorized as 建站知识 Tagged ,

By 傻大憨

shadahan.com是一个关注跨境电商、创业话题的网站。

WordPress建站流程详解(分七个步骤)

如果你打算使用WordPress搭建自己的网站,那么本文将为你提供一份详细的建站流程。通过以上七个步骤,你应该能够成功地使用WordPress搭建自己的网站。

wordpress中文官网地址

wordpress中文官网地址是什么

wordpress调用全站随机文章

wordpress调用全站随机文章代码

wordpress建站必备的函数大全

wordpress主题二次开发时常用到的函数

专业的WooCommerce模板定制服务商

WooCommerce作为一款广受欢迎的WordPress电子商务插件,为众多商家提供了搭建在线商店的便捷途径。

wordpress父分类和归档页调用子分类名称和链接

分类名称与分类链接调用问题,category和archives调用下级子分类的名称和链接。