傻大憨

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禁用Rest API

将以下代码插入到functions.php文件中即可禁用Rest API

把页面内容从wordpress的搜索结果中去掉

把wordpress的页面内容从搜索结果中移除的时候,除了使用插件以外,还可以使用非插件的方法,用一段代码就可以实现。

wordpress搜索自字义字段内容

有些网站需要根据自定义段字的内容来做为搜索项,比如,房产中介公司wordpress网站,需要搜索同一区域内容的楼盘,然后展示出内容。

怎么用wordpress自己创建一个网站

过去建网站需要专业的程序员来做,现在只要学习一下教程,就可以自己使用开源的CMS搭建网站。

WordPress为某个分类添加特定的内容页模板

为某个分类目录category添加特定的内容页single模板