I have a search Ajax script without reloading the page, I select the taxonomy's to filter the content, and I click on "Search", in that the search form disappears, a loading bar appears. The loading bar disappears and the searched content appears. so that's fine, except that I need the search form not to disappear, the loading bar to be below it.
<?php
/*
Plugin Name: Ultimate WP Query Search Filter
Plugin URI: http://www.9-sec.com/
Description: This plugin let you using wp_query to filter taxonomy,custom meta and post type as search result.
Version: 1.0.10
Author: TC
Author URI: http://www.9-sec.com/
*/
if ( ! defined( 'UWPQSFBASE' ) )
define( 'UWPQSFBASE', untrailingslashit( dirname( __FILE__ ) ) );
if ( ! defined( 'UADDFORMURL' ) )
define( 'UADDFORMURL', admin_url('admin.php?page=uwpqsfform') );
if(!class_exists('ulitmatewpsf')){
include_once('classes/uwpqsf-base-class.php');
include_once('admin/list-from-class.php');
include_once('classes/uwpqsf-front-class.php');
include_once('classes/uwpqsf-process-class.php');
include_once('functions.php');
class ulitmatewpsf{
const post_type = 'uwpqsf';
function __construct(){
add_action( 'init' , array( $this,'uwpqsf_setting' ) );
add_action('admin_menu', array($this,'uwpqsf_menu'));
//save form
add_action('admin_init', array($this,'uwpqsf_save_from'));
// admin add taxonomy ajax
add_action( 'wp_ajax_uwpqsfTaxo_ajax', array( $this,'uwpqsfTaxo_ajax') );
// admin add meta fields ajax
add_action( 'wp_ajax_uwpqsfCmf_ajax', array( $this,'uwpqsfCmf_ajax') );
//generate exlude terms
add_action( 'wp_ajax_uwpqsfexclude_terms', array( $this,'uwpqsfexclude_terms') );
}
function uwpqsf_setting(){
register_post_type( self::post_type, array(
'labels' => array(
'name' => __( 'Ultimate WPQSF', 'UWPQSF' ),
'singular_name' => __( 'Ultimate AWPSF', 'UWPQSF' ) ),
'exclude_from_search'=>true,
'publicly_queryable'=>false,
'rewrite' => false,
'query_var' => false ) );
load_plugin_textdomain( 'UWPQSF', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
add_shortcode('ULWPQSF', array($this, 'U_wpqsf_shortcode'));
add_filter('widget_text', 'do_shortcode');
}
function uwpqsf_menu() {
if(isset($_GET['page']) && isset($_GET['uformaction']) && $_GET['page'] == 'uwpqsfform' && $_GET['uformaction'] == 'edit'){
if(isset($_GET['uformid']) && absint($_GET['uformid'])){
$editmenu = __("Edit Form","UWPQSF");
$title = __("Edit Ultimate WPQSF ","UWPQSF");
}
}
$menutitle = isset($editmenu) ? $editmenu : __("Add Form","UWPQSF");
$pagetitle = isset($title) ? $title : __("Add New Ultimate WPQSF ","UWPQSF");
add_menu_page(__("Ultimate Query Search Filter","UWPQSF"),__("Ulitmate WPQSF","UWPQSF"),'manage_options','ultimatewpqsf', array($this,'Uwoqsf_page'));
$plugin_page = add_submenu_page( 'ultimatewpqsf', $pagetitle , $menutitle, 'manage_options', 'uwpqsfform', array($this,'add_new_form_callback') );
add_action('admin_print_scripts-'.$plugin_page, array($this,'admin_uwpqsf_js'));
add_action('admin_print_styles-'.$plugin_page, array($this,'admin_uwpqsf_css'));
}
function Uwoqsf_page(){
global $uwqsfmain;
$uwqsfmain = new Uwpqsf_Table;
$uwqsfmain->prepare_items();
$uddlink = add_query_arg(array('uformid' => 'new', 'uformaction' => 'new'), UADDFORMURL);
echo '<div class="wrap"><div id="icon-options-general" class="icon32"></div><h2>'.esc_html( __( 'Ultimate WP Query Search Filter', 'UWPQSF' ) ).'<a href="'.$uddlink .'" class="add-new-h2">'.esc_html( __( 'Add New Search Form', 'UWPQSF' ) ).'</a></h2>';
echo '<form method="post">'; $uwqsfmain->display();
echo '</form></div>';
}
function add_new_form_callback(){
require_once UWPQSFBASE . '/admin/forms.php';
}
function admin_uwpqsf_js(){
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('js', plugins_url('admin/scripts/uadmin_awqsfjs.js', __FILE__), array('jquery'), '1.0', true);
wp_localize_script( 'ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
function admin_uwpqsf_css(){
wp_enqueue_style('uwpqsfcss', plugins_url('admin/scripts/admin_uwpqsf.css', __FILE__), '1.0', true);
}
function uwpqsfTaxo_ajax(){
include 'admin/ajax-add-taxo.php';
}
function uwpqsfCmf_ajax(){
include 'admin/ajax-add-cmf.php';
}
function uwpqsf_save_from(){
if(isset($_POST['uwpqsfsub'])){
if (! wp_verify_nonce($_POST['nonce'], 'ultimate-wpqsf-edit') ) {
$this->handle_error()->add('nonce', __("No naughty business here, dude", 'UWPQSF'));
return;
}
$postid =sanitize_text_field($_POST['uformid']);
$themeoption = $cptarray = $taxoarray = $cmfarray =$relarray ='';
if(!empty($_POST['uwpname']['cpt'])){
foreach($_POST['uwpname']['cpt'] as $cv){
$cptarray[] = sanitize_text_field($cv);
}
}
if(isset($_POST['uwpname']['taxo'])){
foreach($_POST['uwpname']['taxo'] as $tv){
$taxoarray[]=array(
'taxname' => sanitize_text_field($tv['taxname']),
'taxlabel'=> sanitize_text_field($tv['taxlabel']),
'taxall' => sanitize_text_field($tv['taxall']),
'hide' => sanitize_text_field($tv['hide']),
'exc' => sanitize_text_field($tv['exc']),
'type' => sanitize_text_field($tv['type']),
'operator' => sanitize_text_field($tv['operator']),
'exsearch' => sanitize_text_field($tv['exsearch']),
);
}
}
if(isset($_POST['uwpname']['cmf'])){
foreach($_POST['uwpname']['cmf'] as $cv){
$cmfarray[] = array(
'metakey' => sanitize_text_field($cv['metakey']),
'label' => sanitize_text_field($cv['label']),
'all' => sanitize_text_field($cv['all']),
'compare' => wp_filter_nohtml_kses( stripslashes($cv['compare'])),
'type' => sanitize_text_field($cv['type']),
'opt' => sanitize_text_field($cv['opt'])
);
}
}
if(isset($_POST['uwpname']['rel'])){
foreach($_POST['uwpname']['rel'] as $rv){
$relarray[] = array(
'method'=> isset($rv['method']) ? sanitize_text_field($rv['method']) : '',
'tax'=> isset($rv['tax']) ? sanitize_text_field($rv['tax']) : '',
'cmf'=> isset($rv['cmf']) ? sanitize_text_field($rv['cmf']) : '',
'strchk'=> isset($rv['strchk']) ? sanitize_text_field($rv['strchk']) : '',
'strlabel'=> isset($rv['strlabel']) ? $rv['strlabel'] : '',
'smetekey'=> isset($rv['smetekey']) ? $rv['smetekey'] :'',
'otype'=> isset($rv['otype']) ? sanitize_text_field($rv['otype']) : '',
'sorder'=> isset($rv['sorder']) ? sanitize_text_field($rv['sorder']) : '',
'button'=> isset($rv['button']) ? $rv['button'] : '',
'resultc'=> isset($rv['resultc']) ? $rv['resultc'] : '',
'div'=> isset($rv['div']) ? $rv['div'] : '',
'snf'=> isset($rv['snf']) ? $rv['snf'] : '',
);
}
}
if(isset($_POST['themeopt'])){
$themeoption = $_POST['themeopt'];
}
if($postid == 'new'){
$post_information = array(
'post_title' => sanitize_text_field($_POST['ftitle']) ,
'post_type' => self::post_type,
'post_status' => 'publish'
);
$newform_id = wp_insert_post($post_information);
if(empty($newform_id)){
$this->handle_error()->add('insert', __("Error! Try to create again.", 'UWPQSF'));
return;
}
if(!empty($cptarray) ){
update_post_meta($newform_id, 'uwpqsf-cpt', $cptarray);}
if(!empty($taxoarray)){
update_post_meta($newform_id, 'uwpqsf-taxo', $taxoarray);}
if(!empty($cmfarray)){
update_post_meta($newform_id, 'uwpqsf-cmf', $cmfarray);}
if(!empty($relarray)){
update_post_meta($newform_id, 'uwpqsf-option', $relarray);}
if(!empty($themeoption)){
update_post_meta($newform_id, 'uwpqsf-theme', $themeoption);}
do_action('saving_uwpqsf_form', $_POST);
$returnlink = add_query_arg(array('uformid' => $newform_id, 'uformaction' => 'edit','status'=>'success'), UADDFORMURL);
wp_redirect( $returnlink ); exit;
}//end add new
if($postid != 'new' && absint($postid) ){
$updateform = array();
$updateform['ID'] = $postid ;
$updateform['post_title'] = sanitize_text_field($_POST['ftitle']);
$update = wp_update_post( $updateform );
if(empty($update)){
$this->handle_error()->add('update', __("Error! Something wrong when updating your setting.", 'UWPQSF'));
return;
}
$oldcpt = get_post_meta($postid, 'uwpqsf-cpt', true);
$oldtaxo = get_post_meta($postid, 'uwpqsf-taxo', true);
$oldcmf = get_post_meta($postid, 'uwpqsf-cmf', true);
$oldrel = get_post_meta($postid, 'uwpqsf-option', true);
$oldthemeopt = get_post_meta($postid, 'uwpqsf-theme', true);
$newcpt = !empty($cptarray) ? $cptarray : '';
$newtaxo = !empty($taxoarray) ? $taxoarray : '';
$newcmf = !empty($cmfarray) ? $cmfarray : '';
$newrel = !empty($relarray) ? $relarray : '';
$newthemeopt = !empty($themeoption) ? $themeoption : '';
if (empty($newcpt)) {
delete_post_meta($postid, 'uwpqsf-cpt', $oldcpt);
} elseif($oldcpt != $newcpt) {
update_post_meta($postid, 'uwpqsf-cpt', $newcpt);
}
if (empty($newtaxo)) {
delete_post_meta($postid, 'uwpqsf-taxo', $oldtaxo);
} elseif($newtaxo != $oldtaxo) {
update_post_meta($postid, 'uwpqsf-taxo', $newtaxo);
}
if (empty($newcmf)) {
delete_post_meta($postid, 'uwpqsf-cmf', $oldcmf);
} elseif ($newcmf != $oldcmf) {
update_post_meta($postid, 'uwpqsf-cmf', $newcmf);
}
if (empty($newrel)) {
delete_post_meta($postid, 'uwpqsf-option', $oldrel);
} elseif ($newrel != $oldrel) {
update_post_meta($postid, 'uwpqsf-option', $newrel);
}
if($newthemeopt != $oldthemeopt) {
update_post_meta($postid, 'uwpqsf-theme', $newthemeopt);
}
do_action('saving_uwpqsf_form', $_POST);
$returnlink = add_query_arg(array('uformid' => $postid, 'uformaction' => 'edit','status'=>'updated'), UADDFORMURL);
wp_redirect( $returnlink ); exit;
}//end update
}//end submit
}
function U_wpqsf_shortcode($atts){
extract(shortcode_atts(array('id' => false, 'formtitle' =>1, 'button' => 1,'divclass' => '', 'infinite'=>'', 'text_position' => 'bottom', 'lang'=>''), $atts));
//wpml
if(function_exists('icl_object_id') && $lang) {
$current_language = ICL_LANGUAGE_CODE;
$languages = explode(' ',$lang);
foreach($languages as $k => $v){
$getLang = explode('=',$v);
if(trim($getLang[0]) == trim($current_language)){
$id = $getLang[1];
break;
}
}
}
if($id)
{
ob_start();
$output = include UWPQSFBASE . '/html/searchform.php';
$output = ob_get_clean();
return $output;
}
else{
echo 'no form added.';
}
}
function uwpqsfexclude_terms(){
$cutax = $_POST['cutax'];
$exterms = $_POST['exterms'];
$ediv = '.'.$_POST['ediv'];
$edis = array();
if(!empty($exterms)){
$edis = explode(",", $exterms );
}
echo '<h3>'.__('Selected Taxonomy : '.$cutax,"UWPQSF").'</h3><br>';
if(!empty($cutax)){
$gterms = get_terms( $cutax , array('hide_empty' => 0 ) );
foreach($gterms as $gterm){
echo '<label><input ',in_array($gterm->term_id,$edis) ? 'checked = "checked" ' : '',' type="checkbox" class="exids" value="'.$gterm->term_id.'">'.$gterm->name.'</label>';
}
}else{
if(empty($cutax)){
echo __("Please Select a taxonomy first","UWPQSF");}
else{
echo __("No term found in this taxonomy ","UWPQSF");
}
}
echo '<input type="hidden" id="ediv" value="'.$ediv.'">';
exit;
}
}//end of class
}//end of check class
global $uwpqsf;
$uwpqsf = new ulitmatewpsf();
?>
jQuery(document).ready(function($) {
$('body').on('click','.usearchbtn', function(e) {
process_data($(this));
return false;
});
$('body').on('click','.upagievent', function(e) {
var pagenumber = $(this).attr('id');
var formid = $('#curuform').val();
upagi_ajax(pagenumber, formid);
return false;
});
$('body').on('keypress','.uwpqsftext',function(e) {
if(e.keyCode == 13){
e.preventDefault();
var form = $(this).parent().parent().attr('id');
if (!form) {
id = $(this);
}else{
var id = $('#'+form);
}
process_data(id);
}
});
window.process_data = function ($obj) {
var ajxdiv = $obj.closest("form").find("#uajaxdiv").val();
var res = {loader:$('<div />',{'class':'umloading'}),container : $(''+ajxdiv+'')};
var formid = $obj.parent().parent().attr('id'); console.log(formid);
var getdata = $obj.closest("form").serialize();
var pagenum = '1';
jQuery.ajax({
type: 'POST',
url: ajax.url,
data: ({action : 'uwpqsf_ajax',getdata:getdata, pagenum:pagenum }),
beforeSend:function() {$(''+ajxdiv+'').empty();res.container.append(res.loader);$obj.closest("form").find('input, textarea, button, select').attr("disabled", true);},
success: function(html) {
res.container.find(res.loader).remove();
$(''+ajxdiv+'').html(html);
$obj.closest("form").find('input, textarea, button, select').attr("disabled", false);
}
});
}
window.upagi_ajax = function (pagenum, formid) {
var ajxdiv = $(''+formid+'').find("#uajaxdiv").val();
var res = {loader:$('<div />',{'class':'umloading'}),container : $(''+ajxdiv+'')};
var getdata = $(''+formid+'').serialize();
jQuery.ajax({
type: 'POST',
url: ajax.url,
data: ({action : 'uwpqsf_ajax',getdata:getdata, pagenum:pagenum }),
beforeSend:function() {$(''+ajxdiv+'').empty(); res.container.append(res.loader);},
success: function(html) {
res.container.find(res.loader).remove();
$(''+ajxdiv+'').html(html);
//res.container.find(res.loader).remove();
}
});
}
$('body').on('click', '.chktaxoall, .chkcmfall',function () {
$(this).closest('.togglecheck').find('input:checkbox').prop('checked', this.checked);
});
});//end of script
<?php
if(!class_exists('uwpqsfront')){
class uwpqsfront{
function output_formtaxo_fields($type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass){
$eid = explode(",", $exc);
$args = array('hide_empty'=>$hide,'exclude'=>$eid );
$taxoargs = apply_filters('uwpqsf_taxonomy_arg',$args,$taxname,$formid);
$terms = get_terms($taxname,$taxoargs);
$count = count($terms);
if($type == 'dropdown'){
$html = '<div class="'.$defaultclass.' '.$divclass.'" id="tax-select-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span>';
$html .= '<input type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
$html .= '<input type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
$html .= '<select id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term]">';
if(!empty($taxall)){
$html .= '<option selected value="uwpqsftaxoall">'.$taxall.'</option>';
}
if ( $count > 0 ){
foreach ( $terms as $term ) {
$selected = (isset($_GET['taxo'][$c]['term']) && $_GET['taxo'][$c]['term'] == $term->slug) ? 'selected="selected"' : '';
$html .= '<option value="'.$term->slug.'" '.$selected.'>'.$term->name.'</option>';}
}
$html .= '</select>';
$html .= '</div>';
return apply_filters( 'uwpqsf_tax_field_dropdown', $html ,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass);
}
if($type == 'checkbox'){
if ( $count > 0 ){
$html = '<div class="'.$defaultclass.' '.$divclass.' togglecheck" id="tax-check-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span >';
$html .= '<input type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
$html .= '<input type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
if(!empty($taxall)){
$checkall = (isset($_GET['taxo'][$c]['call']) && $_GET['taxo'][$c]['call'] == '1' ) ? 'checked="checked"' : '';
$html .= '<label><input type="checkbox" id="tchkb-'.$c.'-0" class="tchkb-'.$c.' chktaxoall" name="taxo['.$c.'][call]" value="1" '.$checkall.'>'.$taxall.'</label>';
}
$i = 1;
foreach ( $terms as $term ) {
$value = $term->slug;
$checked = (isset($_GET['taxo'][$c]['term']) && in_array($value, $_GET['taxo'][$c]['term'])) ? 'checked="checked"' : '';
$html .= '<label><input type="checkbox" id="tchkb-'.$c.'-'.$i.'" class="tchkb-'.$c.'" name="taxo['.$c.'][term][]" value="'.$value.'" '.$checked.'>'.$term->name.'</label>';
$i++;
}
$html .= '</div>';
return apply_filters( 'uwpqsf_tax_field_checkbox', $html ,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass);
}
}
if($type == 'radio'){
if ( $count > 0 ){
$html = '<div class="'.$defaultclass.' '.$divclass.'" id="tax-radio-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span>';
$html .= '<input type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
$html .= '<input type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
if(!empty($taxall)){
$html .= '<label><input type="radio" id="tradio-'.$c.'-0" class="tradio-'.$c.'" name="taxo['.$c.'][term]" value="uwpqsftaxoall">'.$taxall.'</label>';
}
$n = 1;
foreach ( $terms as $term ) {
$checked = (isset($_GET['taxo'][$c]['term']) && $_GET['taxo'][$c]['term'] == $term->slug) ? 'checked="checked"' : '';
$html .= '<label><input type="radio" id="tradio-'.$c.'-'.$n.'" class="tradio-'.$c.'" name="taxo['.$c.'][term]" value="'.$term->slug.'" '.$checked.'>'.$term->name.'</label>';
$n++;
}
$html .= '</div>';
return apply_filters( 'uwpqsf_tax_field_radio', $html ,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass);
}
}
if($type != 'dropdown' or $type != 'checkbox' or $type != 'radio') {
return apply_filters( 'uwpqsf_addtax_field_'.$type.'', $type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$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 .= '<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);
}
if($type == 'checkbox'){
$html = '<div class="'.$defaultclass.' '.$divclass.' togglecheck" id="cmf-check-'.$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.'">';
if(!empty($all)){
$checkall = (isset($_GET['cmf'][$i]['call']) && $_GET['cmf'][$i]['call'] == '1' ) ? 'checked="checked"' : '';
$html .= '<label><input type="checkbox" id="cmf-'.$i.'-0" class="cmf-'.$i.' chkcmfall" name="cmf['.$i.'][call]" value="1" '.$checkall.'>'.$all.'</label>';
}
$c = 1;
foreach ( $opts as $opt ) {
$val = explode('::',$opt);
$checked = (isset($_GET['cmf'][$i]['value']) && in_array($val[0],$_GET['cmf'][$i]['value']) ) ? 'checked="checked"' : '';
$html .= '<label><input type="checkbox" id="cmf-'.$i.'-'.$c.'" class="cmf-'.$i.'" name="cmf['.$i.'][value][]" value="'.$val[0].'" '.$checked.'>'.$val[1].'</label>';
$c++;
}
$html .= '</div>';
return apply_filters( 'uwpqsf_cmf_field_checkbox', $html,$type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass);
}
if($type == 'radio'){
$html = '<div class="'.$defaultclass.' '.$divclass.'" id="cmf-radio-'.$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.'">';
if(!empty($all)){
$html .= '<label><input type="radio" id="cmf-'.$i.'-0" class="cmf-'.$i.'" name="cmf['.$i.'][value]" value="uwpqsfcmfall">'.$all.'</label>';
}
$n = 1;
foreach ( $opts as $opt ) {
$val = explode('::',$opt);
$checked = (isset($_GET['cmf'][$i]['value']) && $_GET['cmf'][$i]['value'] == $val[0]) ? 'checked="checked"' : '';
$html .= '<label><input type="radio" id="cmf-'.$i.'-'.$n.'" class="cmf-'.$i.'" name="cmf['.$i.'][value]" value="'.$val[0].'" '.$checked.'>'.$val[1].'</label>';
$n++;
}
$html .= '</div>';
return apply_filters( 'uwpqsf_cmf_field_radio', $html,$type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass);
}
if($type != 'dropdown' or $type != 'checkbox' or $type != 'radio') {
return apply_filters( 'uwpqsf_addcmf_field_'.$type.'', $type,$metakey,$compare,$metaval,$label,$all,$i,$defaultclass,$id,$divclass);
}
}
}//end class
}//end check class
;?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><?php$nonce=wp_create_nonce('uwpsfsearch');$taxo=get_post_meta($id,'uwpqsf-taxo',true);$cmf=get_post_meta($id,'uwpqsf-cmf',true);$options=get_post_meta($id,'uwpqsf-option',true);$css=get_post_meta($id,'uwpqsf-theme',true);$excss=explode('|',$css);$divid=($excss[2])?$excss[2]:'uwpqsf_id';$defaultclass=($excss[3])?$excss[3]:'uwpqsf_class';if($options[0]['method']=='1'){$hidden='<inputtype="hidden" id="uajaxdiv" value="'.$options[0]['div'].'">';
$btype = 'button';
$method = '';
$bclass = 'usearchbtn';
$auto = true;
}else{
$hidden = '<input type="hidden" name="s" value="uwpsfsearchtrg" />';
$btype = 'submit';
$method = 'method="get" action="'.home_url( '/' ).'"';
$bclass ='';
$auto = false;
}
$fields = new uwpqsfront();
$html = '<div id="'.$divid.'">';
$html .= '<form id="uwpqsffrom_'.$id.'" '.$method.'>';
if($formtitle){
$html .= '<div class="uform_title">'.get_the_title($id).'</div>';
}
$html .= '<input type="hidden" name="unonce" value="'.$nonce.'" /><input type="hidden" name="uformid" value="'.$id.'">';
$html .= $hidden;
ob_start();
$html .= do_action( 'uwpqsf_form_top', $atts);
$html .= ob_get_clean();
if(isset($options[0]['strchk']) && ($options[0]['strchk'] == '1') && $text_position =="top"){
$stext = '<div class="'.$defaultclass.' '.$divclass.'"><label class="'.$defaultclass.' '.$divclass.'-keyword">'.$options[0]['strlabel'].'</label>';
$oldvalue = (isset($_GET['skeyword'])) ? $_GET['skeyword'] : '';
$stext .= '<input id="'.$divid.'_key" type="text" name="skeyword" class="uwpqsftext" value="'.$oldvalue.'" />';
$stext .= '</div>';
$textsearch = apply_filters('uwpqsf_string_search',$stext, $id,$divid,$defaultclass,$divclass,$options);
$html .= $textsearch;
}
if(!empty($taxo)){
$c = 0;
foreach($taxo as $k => $v){
$eid = explode(",", $v['exc']);
$args = array('hide_empty'=>$v['hide'],'exclude'=>$eid );
$terms = get_terms($v['taxname'],$args);
$count = count($terms);
$html .= $fields->output_formtaxo_fields($v['type'],$v['exc'],$v['hide'],$v['taxname'],$v['taxlabel'],$v['taxall'],$v['operator'],$c,$defaultclass,$id,$divclass );
$c++;
}
}
ob_start();
do_action( 'uwpqsf_form_mid', $atts);
$html .= ob_get_clean();
if(!empty($cmf)){
$i=0;
foreach($cmf as $k => $v){
if(isset($v['type'])){
$html .= $fields->output_formcmf_fields($v['type'],$v['metakey'],$v['compare'],$v['opt'],$v['label'],$v['all'],$i,$defaultclass,$id,$divclass );
$i++;
}
}
}
if(isset($options[0]['strchk']) && ($options[0]['strchk'] == '1') && $text_position =="bottom"){
$stext = '<div class="'.$defaultclass.' '.$divclass.'"><label class="'.$defaultclass.' '.$divclass.'-keyword">'.$options[0]['strlabel'].'</label>';
$oldvalue = (isset($_GET['skeyword'])) ? $_GET['skeyword'] : '';
$stext .= '<input id="'.$divid.'_key" type="text" name="skeyword" class="uwpqsftext" value="'.$oldvalue.'" />';
$stext .= '</div>';
$textsearch = apply_filters('uwpqsf_string_search',$stext, $id,$divid,$defaultclass,$divclass,$options);
$html .= $textsearch;
}
ob_start();
do_action( 'uwpqsf_form_bottom' , $atts);
$html .= ob_get_clean();
if($button && $button == '1'){
$wrapper = '<div class="'.$defaultclass.' '.$divclass.' uwpqsf_submit" id="uwpqsf_btn">';
$wrapper .= '<input type="'.$btype.'" id="'.$divid.'_btn" value="'.$options[0]['button'].'" alt="[Submit]" class="usfbtn '.$bclass.'" /></div>';
$btn = apply_filters('uwpsqf_form_btn', $wrapper, $id,$divclass,$defaultclass,$divid,$options[0]['button'] );
$html .= $btn;
}elseif($button == '0'){
if($auto){
$form = '"#uwpqsffrom_'.$id.'"';
ob_start();
?>
<script type="text/javascript">jQuery(document).ready(function($) {
var formid = <?php echo $form; ?>;
$(formid).find('input, textarea, button, select').change(function(){
process_data($(this));
})
;})</script>
<?php
$html .= ob_get_clean();
}
}
if(function_exists('icl_object_id') && $lang) {
$html .= '<input type="hidden" name="lang" value="'.$current_language.'"/>';
}
$html .= '<div style="clear:both"></div>';
$html .= '</form>';//end form
$html .= '</div>'; //end div
echo $html;
;?>