wordpress - Child category list on the sidebar -
wordpress - Child category list on the sidebar -
good day can 1 help me need sub categories associated post , set on widget list in sidecar how can this? how illustration computers main category child/subcategory monitor , cpu etc.
computers (main category)
monitor processor harddrive psu memory now if have post lets have article "hp e241i review" on sidebar need have list of child/ sub category associated post, monitor, processor, harddrive, psu , memory. possible appreciate help
edit here used issue need main category id of article place within "parent" array replacing "category id" don't know how
<?php $args = array( 'orderby' => 'name', 'parent' => 'category id', 'hide_empty' => 1 , ); $categories = get_categories( $args ); $content=''; foreach ( $categories $category ) { echo '<a href="' . get_category_link( $category->term_id ) . '">' . $category->name . '</a> <br/>'; } ?>
to list categories including sub categories utilize <?php echo get_the_category_list();?>, print categories , sub categories
wordpress
Comments
Post a Comment