Wordのクラッカー
Keymaster
現在のカテゴリ内の全記事数を返す
function display_current_category_post_count(){
$ count = ";
if(is_category()){
グローバル$ wp_query;
$ cat_ID = get_query_var( 'cat');
$ categories = get_the_category();
foreach($ categories as $ cat){
$ id = $ cat-> cat_ID;
if($ id == $ cat_ID){
$ count = $ cat-> category_count;
}
}
}
return $ count;
}
使用例:
投稿。
2015年3月17日at 10:29午後