Support Forum


Notice: get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /home/myhphone/public_html/wp-includes/functions.php on line 4329

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Trying to get property of non-object in /home/myhphone/public_html/wp-content/plugins/mingle-forum/wpf.class.php on line 1359

Notice: Use of undefined constant options - assumed 'options' in /home/myhphone/public_html/wp-content/plugins/smart-donations/smart-donations-helpers.php on line 231

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.






NOTE : Due to personal issue, this Ultimate WP Query Search Filter Plugin is no longer under development. Thanks for the support over the years.

Anyone that come across this page that want to find a realible saerch plugin, here are the list of potential replacements.

Plugin author will no longer giving support here, however you can still asking for help from other users here.
Pages: [1]
Author Topic: Filter results on taxonomy page
mqws
Newbie
Posts: 4
Permalink
Post Filter results on taxonomy page
on: January 11, 2014, 09:38

Hi,

I have the following issue. I work with a lot of taxonomies.
For the taxonomy country and region I have taxonomy archives.
For example: Taxonomy country france I have a page:
http://www.sitename.nl/country/france

for a region I have http://www.sitename.nl/region-france/regionname

At every taxonomy archive I've added a Ajax filter form (display results on same page), where the user can filter with from several different taxonomies. Issue is that when I filter at the page of France, it shows results from (as example) Italy as well.

I'm using a custom function to show the results. I know I'll have to add something like:
$arg = array(
'country' => 'france'
);

$query = new WP_Query( $arg );
only changing 'country' => 'france' to something that automatically the right taxonomy etc. is added to the array.

When i'm at the region page it should add: 'region-country' => 'region-name'.

Any clue how to do this?

tck30
Administrator
Posts: 530
Permalink
Post Re: Filter results on taxonomy page
on: January 13, 2014, 15:28

You can use 'uwpqsf_form_bottom' to add the region taxonomy in a hidden field.

for example:

add_action('uwpqsf_form_bottom', 'taxonomy_hidden_field'); 
function taxonomy_hidden_field($attr){
$formid = $attr['id'];
$html = '';
 if($formid == 'form id for each of your form')//let say the form is in france taxonmy
{ 
$html .= '<input  type="hidden" name="taxo[99][name]" value="contry">';//taxonomy
			$html .= '<input  type="hidden" name="taxo[99][opt]" value="1">';// 1 is IN, 2 is NOT In, 3 is AND
			$html .= '<input  type="hidden" name="taxo[99][term]" value="france'">';//the term
}
if($formid == '{other form id}'){
$html .= '<input  type="hidden" name="taxo[99][name]" value="contry">';//taxonomy
			$html .= '<input  type="hidden" name="taxo[99][opt]" value="1">';// 1 is IN, 2 is NOT In, 3 is AND
			$html .= '<input  type="hidden" name="taxo[99][term]" value="usa'">';//the term
}
etc
etfc..

echo $html;

}

New Add-On Plugins for Ultimate WP Query Search Filter has been released! Check it out now.

Buy Me A Beer! Thanks

mqws
Newbie
Posts: 4
Permalink
Post Re: Filter results on taxonomy page
on: January 15, 2014, 21:12

Hi,

thanks for that. It is an option, only I have a lot of taxonomy's and terms.
Trying to do the following:

add_action('uwpqsf_form_bottom', 'taxonomy_hidden_field'); 
function taxonomy_hidden_field($attr){
$formid = $attr['id'];
$html = '';
 if(is_tax('land', 'frankrijk'))//let say the form is in france taxonmy
{ 
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
$html .= '<input  type="hidden" name="taxo[99][name]" value="land">';//taxonomy
			$html .= '<input  type="hidden" name="taxo[99][opt]" value="1">';// 1 is IN, 2 is NOT In, 3 is AND
			$html .= '<input  type="hidden" name="taxo[99][term]" value="echo $term->name;">';//the term
}

Unfortunately it doesn't work. Is it possible in such a way?
Thanks

Joost

mqws
Newbie
Posts: 4
Permalink
Post Re: Filter results on taxonomy page
on: January 15, 2014, 21:25

I fixed it!!!!

This is the result for those that need it as well:

<?php
add_action('uwpqsf_form_bottom', 'taxonomy_hidden_field'); 
function taxonomy_hidden_field($attr){
$formid = $attr['id'];
$html = '';
 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
{ 
$html .= '<input  type="hidden" name="taxo[99][name]" value="land">';//taxonomy
			$html .= '<input  type="hidden" name="taxo[99][opt]" value="1">';// 1 is IN, 2 is NOT In, 3 is AND
			$html .= '<input  type="hidden" name="taxo[99][term]" value="'. $term->name .'">';//the term
}
echo $html;

}
?>
carplu
Newbie
Posts: 12
Permalink
Post Re: Filter results on taxonomy page
on: January 18, 2014, 14:35

Would you mind sharing your site where this is active? i might be interested too, but like to see it in action first

maryplumme-
r
Newbie
Posts: 2
Permalink
Post Re: Filter results on taxonomy page
on: February 13, 2014, 03:27

Thanks guys...Took it a bit further because I want this on all my archive pages. This does the trick so that you don't have to specify a taxonomy in functions.php:

add_action('uwpqsf_form_bottom', 'taxonomy_hidden_field');
function taxonomy_hidden_field($attr){

$html = '';
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
{
$html .= '<input type="hidden" name="taxo[99][name]" value="'. $the_tax->name .'">';//taxonomy
$html .= '<input type="hidden" name="taxo[99][opt]" value="1">';// 1 is IN, 2 is NOT In, 3 is AND
$html .= '<input type="hidden" name="taxo[99][term]" value="'. $term->name .'">';//the term
}
echo $html;

}

jruizwordp-
ress
Newbie
Posts: 4
Permalink
Post Re: Filter results on taxonomy page
on: November 28, 2014, 09:33

I would like to include always a category of products (accesories) when our users search via WPQSF plugin in this website http://bit.ly/1vp8lhe. I mean If someone looks for different attributes like ...

- RADIO => 3G or 4G
- SOFTWARE => Java or Linux

Some products from ACCESORIES category should be shown if they have one of these previous attributes. For example ..

1) The product ANTENNA has the 3G attribute
2) The user looks in the filter for products with 3G and Linux attributes. So only 3G and Linux products will be shown.
3) But an accesory which has only 3G attribute (not Linux) should be shown joined to all previous ones

Accesories work totally different to the rest of products. They work as I have just written here step by step.

THANKS!

Pages: [1]

Leave a Reply

Your email address will not be published. Required fields are marked *