WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
[resolved] Integrate QMT funcktions into existing Form (2 posts)

  1. Axenstar86
    Member
    Posted 1 year ago #

    Hi all,

    I tried to add the QMT functionality to query multiple terms with checkboxes myself. This seems to be harder as I thought.

    So now I am asking myself if there is any way to put the plugin's functionality into an existing form.

    My form looks like below:
    http://pastebin.com/Gi2euw3Q

    In this version it isn't possible to query multiple terms, as the terms are getting dropped.

    Any help would rock!

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

  2. Axenstar86
    Member
    Posted 1 year ago #

    Got it working now, without hte plugin. Thanks to

    http://wordpress.org/support/topic/search-multiple-taxonomies-witch-checkboxes

    Just use the following code in your functions.php

    //explode checkboxes array when doing a search
    	$_GET = yclads_implode_checkboxes_taxonomies($_GET);
    
    function yclads_implode_checkboxes_taxonomies($request_var) {
    
    	$args = array('your tax here');
    
    	foreach($request_var as $arg_key=>$arg_value) {
    		unset($value);
    		if (!in_array($arg_key,$args)) continue;
    		$value= $request_var[$arg_key];
    		if (!$value) continue;
    		if (!is_array($value)) continue;
    		$new_args[$arg_key]=implode(',',$value); //'OR' operator
    	}
    
    	$new_args = array_filter((array)$new_args);
    	$output = wp_parse_args( $new_args, $request_var );
    
    	//DEBUG
    	$yclads_debug['checkboxes_args_before']=$request_var;
    	$yclads_debug['checkboxes_args_after']=$output;
    
    	return $output;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic