• Good evening guys,
    I’m running a directory like website on wordpress, and what I need to do is the following:
    I have a custom_taxonomy which is my countries list already in DB. How it works now is that when a new member registers he types the City himself. What i want to do is to create all those cities and let them choose from dropdown list. How would have to change the code here to get the subcategory of the selected Country display above?

    <div class="input">
    <?php
    $args = array(
    	'show_option_none'   => _d('Select city',402),
    	'orderby'            => 'name',
    	'order'              => 'ASC',
    	'hide_empty'         => 0,
    	'echo'               => 1,
    	'selected'           => $city,
    	'hierarchical'       => 1,
    	'name'               => 'city',
    	'id'                 => 'city',
    	'class'              => 'city',
    	'depth'              => 1,
    	'taxonomy'           => 'people-from',
    	'hide_if_empty'      => false );
    wp_dropdown_categories( $args );
    ?>
        </div>
Viewing 1 replies (of 1 total)
  • Thread Starter tonyzomba

    (@tonyzomba)

    Hey i have an update…. With the following code but depth changed to “2” i get in the list all the Countries and Cities as subcategories.

    <div class="input">
    <?php
    $args = array(
    	'show_option_none'   => _d('Select city',402),
    	'orderby'            => 'name',
    	'order'              => 'ASC',
    	'hide_empty'         => 0,
    	'echo'               => 1,
    	'selected'           => $city,
    	'hierarchical'       => 1,
    	'name'               => 'city',
    	'id'                 => 'city',
    	'class'              => 'city',
    	<strong>'depth'              => 2,</strong>
    	'taxonomy'           => 'people-from',
    	'hide_if_empty'      => false );
    wp_dropdown_categories( $args );
    ?>
        </div>

    Now the question is what do i change in this table to get rid of the Countries in my dropdown list?

Viewing 1 replies (of 1 total)
  • The topic ‘PHP wizz needed. Display subcategory of a custom taxonomy.’ is closed to new replies.