Skip Navigation

[Resolved] [wpv-control] drop down not behaving as expected

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by lolaz 6 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#613077

I am trying to: implement a parametric search by category and exclude specific categories from the dropdown. I am using [wpv-control url_param="wpv-category" type="select" values="0,our-news,press-releases,in-the-news,policy-news" display_values="All categories,Our News,Press releases,In the media,Policy news"] but the results are not updaying when the values are changed in the filter.

Link to a page where the issue can be seen: hidden link

I expected to see:

Instead, I got:

#613126

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I need to check why its not filtering the view's output items and for that I need temporary access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#613217

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I've changed your view's taxonomy filter as given under:

Select posts with taxonomy:
Categories slug in one of those set by the URL parameter wpv-category
eg. <em><u>hidden link</u></em>

And I can see the filter is applied.

Do you want to filter your view before it display the default results to these 4 taxonomy terms you added as filter select box?

#613245

yes thats correct. I would like to apply filters (exclude some categories from the query) and then filter those results by the 4 taxonomy terms

#613247

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can use view's filter - wpv_filter_query in order to modify view's query on fly.

More info:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

I see in your functions.php file there is already code added for such thing but it's commented out:

/*
add_filter( 'wpv_filter_query', 'tax_filter_default_func', 1, 3 );
function tax_filter_default_func( $query, $settings, $views_id ) {
     
    if($views_id != 18218 || !isset($_GET['wpv-category'][0])) return $query;
    if(empty($_GET['wpv-category'][0])){
        unset($_GET['wpv-category']);
    }
    return $query;
}
*/

You should use above hook and check if view's loads first time by checking any of URL param.

If you do not know how to do it, let me know, I'm happy to fix it for you.

#613253

HI Minesh,

i added the code in functions.php to display all content if the category is not set. If you could help me with modifying that query it would be great.

#613305

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - that will be kind of another question, how to prefilter view results before we display the view. Could you please kindly open a new ticket with this question. You can assign it to me as well.

This will help other users searching on the forum. Thank you for understanding.

#613352

Thanks i will open a new ticket