Answer the question
In order to leave comments, you need to log in
How to make the filter conditions work?
1. There is a regular drop-down menu that, if selected, makes a post filter (according to the Ultimate WP Query Search Filter plugin)
function output_formcmf_fields($type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass ){
$opts = explode("|", $metaval);
if($type == 'dropdown'){
$html = '<div class="'.$defaultclass.' '.$divclass.'" id="cmf-select'.$i.'"><span class="cmflabel-'.$i.'">'.$label.'</span>';
$html .= '<input type="hidden" name="cmf['.$i.'][metakey]" value="'.$metakey.'">';
$html .= '<input type="hidden" name="cmf['.$i.'][compare]" value="'.$compare.'">';
$html .= '<select id="cmfdp-'.$i.'" class="cmfdp-class-'.$i.'" name="cmf['.$i.'][value]">';
if(!empty($all)){
$html .= '<option value="uwpqsfcmfall">'.$all.'</option>';
}
foreach ( $opts as $opt ) {
$val = explode('::',$opt);
$selected = (isset($_GET['cmf'][$i]['value']) && $_GET['cmf'][$i]['value'] == $val[0]) ? 'selected="selected"' : '';
$html .= '<option value="'.$val[0].'" '.$selected.'>'.$val[1].'</option>';
}
$html .= '</select>';
$html .= '</div>';
return apply_filters( 'uwpqsf_cmf_field_dropdown', $html,$type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass);
}
function output_formcmf_fields($type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass ){
$opts = explode("|", $metaval);
if($type == 'dropdown'){
$html = '<div class="'.$defaultclass.' '.$divclass.'" id="cmf-select'.$i.'"><span class="cmflabel-'.$i.'">'.$label.'</span>';
$html .= '<input type="hidden" name="cmf['.$i.'][metakey]" value="'.$metakey.'">';
$html .= '<input type="hidden" name="cmf['.$i.'][compare]" value="'.$compare.'">';
$html .= '<input type="search-for-ddwn" id="brand-filter" name="cmf['.$i.'][value]" data-list="cmfdp-'.$i.'" autocomplete="off" required />';
$html .= '<label for="brand-filter" data-icon="🔍"></label>';
$html .= '<datalist id="cmfdp-'.$i.'">';
$html .= '<select id="cmfdp-'.$i.'" class="cmfdp-class-'.$i.'" name="cmf['.$i.'][value]">';
if(!empty($all)){
$html .= '<option value="uwpqsfcmfall">'.$all.'</option>';
}
foreach ( $opts as $opt ) {
$val = explode('::',$opt);
$selected = (isset($_GET['cmf'][$i]['value']) && $_GET['cmf'][$i]['value'] == $val[0]) ? 'selected="selected"' : '';
$html .= '<option value="'.$val[0].'" '.$selected.'>'.$val[1].'</option>';
}
$html .= '</select>';
$html .= '</datalist>';
$html .= '</div>';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question