WordPress Snippet

ワードプレスをカスタマイズしよう

categoryの取得

カテゴリの取得について

<?php 

$thisCat= get_category(get_query_var('cat'),false);

print_r($thisCat);

echo $thisCat->term_id;
echo $thisCat->name;

 $args= array(
 'type' => 'post',
 'child_of' => 0,
 'orderby' => 'name',
 'order' => 'ASC',
 'hide_empty' => 1,
 'hierarchical'=> 1,
 'exclude' => ,
 'include' => ,
 'number' => ,
 'pad_counts' => false );
$categories= get_categories( $args ); 
var_export($categories);
?>

[emulsion_relate_posts]