Show specific category with child in wp_dropdown_categories (CPT) (1 post)

  1. Puanthanh Gangmei
    Posted 5 years ago #

    Here the code: This is a working code
    global $current_user;
    $authorcategory = get_user_meta( $current_user->ID, 'authorcategory', true );
    $cats_array = get_categories(array('taxonomy' => 'blogs')); ?>
    <select id="cat" name="cat" class="input">
    <?php foreach ( $cats_array as $category ) { ?>
    <?php if ($category->cat_name == $authorcategory) echo $cat->cat_name . ' '; } ?>
    <option value="<?php echo $category->cat_ID; ?>"><?php echo $category->cat_name; ?></option>
    1. Now how do I show the child cats?
    2. How can I hide the parent cat and show only the child cats.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by Puanthanh Gangmei
  • This topic is not resolved
  • WordPress version: 3.1