Can someone help me please, i'm not good with php. i have created a custom post type called "used-car" and a custom taxnomy called "used-car-category" in functions.php
Question:
I need to create a dropdown search form which displays a list of category and subcategory on homepage. example
dropdown 1 [car make] "category"
dropdown 2 [car model] "subcatagory"
Search button
when you select a car model in the dropdown eg audi, second dropdown will display the different model variant of audi.
catagory on the cms looks somthing like this:
audi < catagory
- a1 < subcatagory
- a6 < subcatagory
mercedes < catagory
- a class < subcatagory
- b class < subcatagory
- c class < subcatagory
i would like this search form to be displayed on homepage. can someone help me please? a working code would be helpful.
Thanks
Can someone help me please, i'm not good with php. i have created a custom post type called "used-car" and a custom taxnomy called "used-car-category" in functions.php
Question:
I need to create a dropdown search form which displays a list of category and subcategory on homepage. example
dropdown 1 [car make] "category"
dropdown 2 [car model] "subcatagory"
Search button
when you select a car model in the dropdown eg audi, second dropdown will display the different model variant of audi.
catagory on the cms looks somthing like this:
audi < catagory
- a1 < subcatagory
- a6 < subcatagory
mercedes < catagory
- a class < subcatagory
- b class < subcatagory
- c class < subcatagory
i would like this search form to be displayed on homepage. can someone help me please? a working code would be helpful.
Thanks
<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
<tr class="form-field term-parent-wrap">
<th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
<td>
<?php
$dropdown_args = array(
'hide_empty' => 0,
'hide_if_empty' => false,
'taxonomy' => $taxonomy,
'name' => 'parent',
'orderby' => 'name',
'selected' => $tag->parent,
'exclude_tree' => $tag->term_id,
'hierarchical' => true,
'show_option_none' => __( 'None' ),
);
/** This filter is documented in wp-admin/edit-tags.php */
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
wp_dropdown_categories( $dropdown_args ); ?>
<?php if ( 'category' == $taxonomy ) : ?>
<p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
<?php endif; ?>
</td>
</tr>
<?php endif; // is_taxonomy_hierarchical() ?>