我使用的分类图像/ WordPress插件(https://en-gb.wordpress.org/plugins/taxonomy-images/)WordPress的分类图片插件显示的所有条款
目标:我有一个海报的分类,我想显示项名称和术语的形象。我希望能够显示,检索我的分类中的所有术语,无论术语名称是否为空。
问题:但是如果两个数据都没有输入,我就不能显示这个术语。我没有设法正确使用'hide_empty'。
任何帮助表示赞赏。 感谢
< PHP
/*
模板名称:GOF海报首页
*/
// https://en-gb.wordpress.org/plugins/taxonomy-images/
? ?>
< PHP
$分类= '每月类';
$ orderby ='name';
$ order ='ASC';
$ show_count = false;
$ pad_counts = false;
$ hierarchical = true;
$ hide_empty = false;
$ title ='';
$ images ='image_id';
的$ args =阵列(
'分类'= > $分类,
'的OrderBy'= > $的OrderBy,
'顺序'= > $顺序,
'SHOW_COUNT个'= > $ SHOW_COUNT个,
'pad_counts'= > $ pad_counts,
'分层'= > $分层,
'hide_empty'= > $ hide_empty,
'title_li'= > $ title
);
// $ terms = get_terms('month-category',$ args);
// $ terms = apply_filters('taxonomy-images-get-terms','month-category',$ args);
$ terms = apply_filters('taxonomy-images-get-terms','',$ args);
如果(空($计算)& & is_wp_error($条件)!){
$计数=计数($条件);
$ i = 0;
$ term_list ='< div id =“poster-cat-wrapper”>';
的foreach($条款$项){
$ term_list。=
'< DIV CLASS = “海报猫” >'。
'< a href =“/ posters /?gof ='。$ term- > name。''>'。
wp_get_attachment_image($ term- > $ images,'detail')。
'<p>'。 $ term- >名称。 '</p >'。
'</a >'。
'</div >';
$ i ++;
//'< a href =“/ posters /?gof ='。$ term- > name。''>'。 $ term- >名称。 '</a >';
if($ count = $ i){
$ term_list。=''; 。
}
否则{
$ term_list = '< /格>';
}
}
}
? >