Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've written a simple dropdown script and I am looking to expand it to include the child taxonomies and posts. I'm not quite sure how to accomplish checking if there are child categories for $tax_slug and to list them if they exist.

My goal is to make it look like this:

    Post 1 (Submits post ID)
    Post 2 (Submits post ID)
    Child Taxonomy (Links to taxonomy page)
    -Post 3 (Submits post ID)
    -Post 4 (Submits post ID)

Current Code:

<div class="one_fourth">
    $tax_slug = 'interior';
$args = array(
    'post_type' => 'manufacturer',
    'orderby' => 'title',
    'order' => 'ASC',
    'tax_query' => array(
        array(
            'taxonomy' => 'product_category',
            'field' => 'slug',
            'terms' => $tax_slug;
        )
    )
);
$the_query = new WP_Query( $args ); ?>

    <?php if ( $the_query->have_posts() ) : ?>

      <h2>Interior</h2>

      <!-- the loop -->
      <form action="<?php bloginfo('url');?>" method="get">
      <select onchange="return this.form.submit()" name="page_id" id="page_id">
        <option value="">Select a Brand</option>
        <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
        <option value="<?php echo $post->ID; ?>"><?php the_title();?></option>
        <?php endwhile; ?>
      </select>
      </form>
      <!-- end of the loop -->

      <!-- pagination here -->

      <?php wp_reset_postdata(); ?>

    <?php else:  ?>
      <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>
</div>
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.