Benutzerdefinierte Felder werden eingerichtet, wenn Kategorien Unterkategorien für Filter auswählen

Hallo all Ich habe benutzerdefinierte Taxonomien und benutzerdefinierte Benutzereingabefelder für die Einreichung ihrer Kleinanzeigen. Also was ich vorhatte zu tun ist: Benutzer sollten Kategorie auswählen, ich möchte es in der Lage, wenn Benutzer eine Kategorie auswählen, um ihn in nächsten Auswahlfeld Unterkategorien dieser Kategorie anzuzeigen.

Also, wenn Benutzer wählen, Automodell> audi, um automatisch zu öffnen unten wählen Feld ist das audi> a3, a4, a5 oder andere.

Ich hoffe, dass ich das ziemlich gut erklärt habe.

Hier ist mein benutzerdefiniertes Feld “category.php”

ID,'submit_post_type',true); $custom_post_types_args = array(); $custom_post_types = get_post_types($custom_post_types_args,'objects'); global $post; foreach ($custom_post_types as $content_type){ if($content_type->name == $template_post_type) { $taxonomy = $content_type->slugs[0]; if($content_type->name =='post' || strtolower($content_type->name) ==strtolower('posts')){ $taxonomy='category'; } } } $catinfo = templ_get_parent_categories($taxonomy); if(count($catinfo) == 0) { echo ''.sprintf(__('You have not created any category for %s post type.So, this listing will be submited as uncategorized.',DOMAIN),$template_post_type).''; } global $cat_array; $total_cp_price = 0; if(isset($_REQUEST['backandedit']) != '' || (isset($_REQUEST['pid']) && $_REQUEST['pid']!="") ){ $place_cat_arr = $cat_array; } else { for($i=0; $i term_taxonomy_id; } } $cat_display = ""; $tmpdata = get_option('templatic_settings'); if(isset($tmpdata['templatic-category_type']) && $tmpdata['templatic-category_type'] != "") { $cat_display = $tmpdata['templatic-category_type']; } if(!$cat_display) { $cat_display = 'checkbox'; } /* Start of checkbox */ if($cat_display == 'checkbox') { if($catinfo) { if($cat_display==''){ $cat_display='checkbox'; } $counter = 0; if(is_active_addons('monetization')){ global $monetization; $total_price = $monetization->templ_total_price($taxonomy); $onclick = "onclick=displaychk();templ_all_categories($total_price);"; }else{ $onclick = "onclick=displaychk()";} ?> 
term_taxonomy_id; $term_tax_id = $catinfo_obj->term_id; $name = $catinfo_obj->name; $cp = trim($catinfo_obj->term_price); if(!isset($cp) || $cp==''){ $cp = 0; } $cat_term = explode(',',@$_REQUEST['category']); if(is_active_addons('monetization') && $cp !='0') { $dispay_price = " (".fetch_currency_with_position($cp).")"; }else{ $dispay_price = ''; } /* cat price works only with monetization */ ?>
term_taxonomy_id; $term_tax_id = $term->term_id; $name = $term->name; $child_cp = $term->term_price; if(!$child_cp){ $child_cp =0; } if(is_active_addons('monetization') && $child_cp!='0') { $dispay_cprice = " (".fetch_currency_with_position($child_cp).")"; }else{ $dispay_cprice =''; } /* cat price works only with monetization */ if($term->category_parent!=$parent_id) { $i++; $parent_id = $term->category_parent; } if($term->category_parent!=0): $p=$i*17; $pad = str_repeat(' -', $p); if($tmp_term_id==$term->category_parent) { $i=1; $p=$i*17; $i++; $pad = str_repeat(' -', $p); } ?> <div class="form_cat" style="margin-left:px;">
<?php endif; } } } echo '
';// finish cf_checkbox div } } /* End of checkbox */ /* Start of selectbox */ if($cat_display=='select' || $cat_display=='multiselectbox') { $args = array('hierarchical' => true ,'hide_empty' => 0, 'orderby' => 'term_group'); $terms = templ_get_parent_categories($taxonomy); if($terms) : if(is_active_addons('monetization')): if($cat_display=='select'): $fetch_pkg = "onchange=fetch_packages(this.value,this.form);"; /* FUNCTION FOR FETCH PACKAGES */ else: $fetch_pkg = "onclick=fetch_packages(this.value,this.form);"; /* FUNCTION FOR FETCH PACKAGES */ endif; else: $fetch_pkg = ''; endif; if($cat_display == 'multiselectbox'){ $multiple = "multiple=multiple"; }else{ $multiple=''; } /* multi select box */ $output .= ''; $output .= ''.__('Select Category',DOMAIN).''; foreach($terms as $term){ $term_id = $term->term_id; $scp = $term->term_price; if($scp == ""){ $scp = 0 ; } /* price will display only when monetization is activated */ if(is_active_addons('monetization') && $scp!='0') { $sdisplay_price = " (".fetch_currency_with_position($scp).")"; }else{ $sdisplay_price =''; } $term_name = $term->name; if(isset($place_cat_arr) && in_array($term_id,$place_cat_arr)){ $selected = 'selected=selected'; }else{ $selected='';} /* category must be selected when gobackand edit /Edit/Renew */ $output .= ''.$term_name.$sdisplay_price.''; $child_terms = templ_get_child_categories($taxonomy,$term_id); /* get child categories term_id = parent id*/ $i=1; $parent_id = $term_id; $tmp_term_id=$term_id; foreach($child_terms as $child_term){ $child_term_id = $child_term->term_id; $child_cp = $child_term->term_price; if($child_term->category_parent!=$parent_id) { $i++; $parent_id=$child_term->category_parent; } if($child_term->category_parent!=0): $p=$i*2; $pad = str_repeat('-', $p); if($tmp_term_id==$child_term->category_parent) { $i=1; $p=$i*2; $i++; $pad = str_repeat('-', $p); } /* price will display only when monetization is activated */ if(is_active_addons('monetization') && $child_cp!='0' ) { $cdisplay_price = " (".fetch_currency_with_position($child_cp).")"; }else{ $cdisplay_price =''; } $term_name = $child_term->name; if(isset($place_cat_arr) && in_array($child_term_id,$place_cat_arr)){ $cselected = 'selected=selected'; }else{ $cselected='';} /* category must be selected when gobackand edit /Edit/Renew */ $pad = str_repeat('-', $p); $output .= ''.$pad.$term_name.$cdisplay_price.''; endif; } //child category foreach loop } $output .= ''; echo $output; endif; } ?> function displaychk(){ dml=document.forms['submit_form']; chk = document.getElementsByName('category[]'); len = chk.length; if(document.submit_form.selectall.checked == true) { for (i = 0; i < len; i++) chk[i].checked = true ; } else { for (i = 0; i < len; i++) chk[i].checked = false ; } }

Solutions Collecting From Web of "Benutzerdefinierte Felder werden eingerichtet, wenn Kategorien Unterkategorien für Filter auswählen"