Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Learndash-将主题类别添加到<;车身等级=”车身等级“&引用&燃气轮机;_Php_Wordpress_Function - Fatal编程技术网

Php Learndash-将主题类别添加到<;车身等级=”车身等级“&引用&燃气轮机;

Php Learndash-将主题类别添加到<;车身等级=”车身等级“&引用&燃气轮机;,php,wordpress,function,Php,Wordpress,Function,我需要将learndash的主题类别插入到中,就像 我的问题是learndash将主题类别插入到标记中,这给了我一些限制 我可以将learndash课程添加到标准的wordpress类别中。使用以下代码,我可以将wordpress类别插入 现在我仍然需要一种将主题类别添加到body类中的方法 感谢您的帮助我刚刚安装了插件“自定义Body类”来添加类主题。 它很好用 但是,如果你们中有人知道一个没有单独插件的解决方案,我会很高兴听到你的消息。我刚刚安装了插件“自定义Body类”来添加类主题。 它很

我需要将learndash的主题类别插入到
中,就像

我的问题是learndash将主题类别插入到
标记中,这给了我一些限制

我可以将learndash课程添加到标准的wordpress类别中。使用以下代码,我可以将wordpress类别插入

现在我仍然需要一种将主题类别添加到body类中的方法


感谢您的帮助

我刚刚安装了插件“自定义Body类”来添加类主题。 它很好用


但是,如果你们中有人知道一个没有单独插件的解决方案,我会很高兴听到你的消息。

我刚刚安装了插件“自定义Body类”来添加类主题。 它很好用

但是,如果你们中有人知道一个解决方案,没有一个单独的插件,我会很高兴听到你

function add_categories( $classes = '' ) {

$categories = get_the_category();
foreach( $categories as $category ) {
$classes[] = 'category-'.$category->slug;


}
 return $classes;
}
add_filter( 'body_class', 'add_categories' );