In my listing site Im trying to show in a specific view all properties but "alquiler" taxonomy, which in my case is "tipos de trasnaccion"
I really dont get to find the solution
So far, on my filter I've tried to set as Im explaining on my captures, but when I reload the view editor, it always come to the same result, My captures explain my issue better.
Just to let you know, I've opened another ticket relating to this, because I have a Custom Field to set a property as a featured one. It seems on my previous ticket https://toolset.com/forums/topic/avoid-to-show-category-results-in-a-view-showing-post-type/
That it was related to this:
"It seems that the issue was occurring because the checkbox field 'Propiedad destacada' was marked as: 'When unchecked, save 0 to the database', while it should be: 'When unchecked, don't save anything to the database'"
I've already did this, but the issue here is that the filters are not working properly, so in my view: called "Home Busqueda" its including all "tipos de transaccion" properties
Hope for your help. thanks
Hello,
I have tried it in a fresh WP installation + the latest version of Toolset plugins, it works fine, see below sandbox website:
Login URL: hidden link
1) Custom taxonomy "trasnaccions":
hidden link
2) Create a post view:
hidden link
- Query posts
- Filter by:
Select posts with taxonomy:
trasnaccions in no one of these: tipos de trasnaccion
3) Test it in frontend:
hidden link
It works fine, is there any missing steps? can you reproduce the same problem in above test site?
Hi Luo
That's exactly how I'm expecting this to work
Unfortunately, Im not being able to make that work this way.
In my view, every time that I change the taxonomy filter, after update it comes to the old result:
"AND
Tipos de transacción slug en ninguno de lo definido por el parámetro de URL wpv-tipotransaccion
p. ej., hidden link"
What Im expecting to happen is to see something like this:
Tipos de transacción in no one of these: Alquiler
I have everything exactly as in your demo.
What may be the problem here?
Thanks
Please provide your website credentials in below private message box, also point out:
- Post view URL
- Page URL, Where I can test the results in frontend.
I need a live website to test and debug
I can login into your website, but I am not sure where can I check the issue, please point out:
- Post view URL
- Page URL, Where I can test the results in frontend.
Hi Luo
The view is this one:
hidden link
The test page will be the homepage: hidden link
Thanks for the detail, please check the post view:
hidden link
in section "Search and Pagination", you are using taxonomy "tipotransaccion" in the custom search form, so you can not add filter with same taxonomy "tipotransaccion".
In your case, it needs custom codes, I have done below modifications in your website:
Dashboard-> Toolset-> Settings-> Custom code:
hidden link
Add one item "exclude-category", with below codes:
add_filter('wpv_filter_query', function($query, $view_setting, $view_id){
if($view_id = 4154){
if(!isset($query['tax_query'])){
$query['tax_query'] = array();
}
$query['tax_query'][] = array(
"taxonomy"=> "tipotransaccion",
"field"=> "slug",
"terms"=> "alquiler",
"operator" => "NOT IN"
);
}
return $query;
}, 99, 3);
Please test again, check if it is what you want.
More helps:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
Hi
I see that works well, but since that change was made, another view seems to be impacted:
hidden link this URL supposed to show all the properties with the "alquiler" category, but is not showing any results.
This is the view:
hidden link
Hope for your answer
Thank you
I have changed the custom code snippet "exclude-category"
hidden link
line 11 from:
if($view_id = 4154){
To:
if($view_id == 4154){
Please test again, check if it is fixed, thanks
Hi Luo
Thank you so much. I now see that is working well, as in the Home Page and in the "Alquiler" page
Thanks again