タイトル
get_template_part('meta');
?>
category_parent ) ) {
$html .= '';
$html .= '' . $category->name . '';
$html .= thk_list_postlist_categories( $category->cat_ID );
$html .= thk_list_parent_categories( $category->cat_ID );
$html .= ''."\n";
}
}
return $html;
}
function thk_list_parent_categories( $parent_id = 0 ) {
$html = '';
$categories = get_categories( 'child_of=' . $parent_id );
foreach( $categories as $category ) {
if( $category->category_parent === $parent_id ) {
$html .= '';
$html .= '' . $category->name . '';
$html .= thk_list_postlist_categories( $category->cat_ID );
$html .= thk_list_parent_categories( $category->cat_ID );
$html .= ''."\n";
}
}
if( !empty( $html ) ) $html = "\n".'';
return $html;
}
function thk_list_postlist_categories( $category_id ) {
global $post;
$html = '';
query_posts( 'cat=' . $category_id . '&posts_per_page=-1' );
if( have_posts() ) {
while( have_posts() ) {
the_post();
if( in_category( $category_id ) ) {
$html .= '' . $post->post_title . '';
$html .= ''."\n";
}
}
}
wp_reset_query();
if( !empty( $html ) ) $html = "\n".'';
return $html;
}