我使用的分類圖像/ 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 = '< /格>';
}
}
}
? >