Skip Navigation

[Resolved] Taxonomy filter via shortcode bug

This support ticket is created 2 years, 10 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.

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 10 replies, has 2 voices.

Last updated by Alessandro 2 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2288789
Schermata 2022-02-10 alle 16.43.32.png

I want to filter 2 taxonomies post via shortcode but it doesn't work for logic operator AND

the filter should show post that has the 2 taxonomies in common but also if I choose one taxonomy it shows results like it uses the OR operator instead of AND

For example i have 2 taxonomies
1. tipologia
2. luogo

tipologia = barca-a-vela
luogo = capri

The shortcode is
[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='barca-a-vela' wpvluogotesti='capri']

if i use this
[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='' wpvluogotesti='capri']
or this
[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='barca-a-vela' wpvluogotesti='']

it shows results and it shouldn't

it shows results also

I give you admin access the page to see is:
hidden link

#2289215

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Actually, when you do not pass anything to the shortcode it will not consider it.

What if you try to use the following shortcode:

[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='0' wpvluogotesti='capri']
or this
[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='barca-a-vela' wpvluogotesti='0']

Do you see it works as expected?

#2289397

Thank you so much!
It works now!!

#2289577

Sorry...
I noticed that if I only choose the "luogotesti" attribute it doesn't work:
[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='0' wpvluogotesti='capri'] it should display only posts with wpvluogotesti = capri but NOT
🙁

#2289581

Minesh
Supporter

Languages: English (English )

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

Can you please share details where exactly you have added the view at what section?

#2289583

I used this code to build a shortcode that retrieves luogo and imbarcazione and creates the views shortcode

function get_shortcode_testo_personalizzato() {
  
  $output = flrt_selected_filter_terms();
  $slug_luogo = $output["luogo"]["values"][0];
  $slug_imbarcazione = $output["imbarcazione"]["values"][0];
  
  if (!$slug_luogo) {
    $slug_luogo = "0";
  }
  
  if (!$slug_imbarcazione) {
    $slug_imbarcazione = "0";
  }
      
  $output_shortcode = "[wpv-view name='testi-personalizzati-shortcode' wpvtipologiabarcatesto ='$slug_imbarcazione' wpvluogotesti='$slug_luogo']";
  
  //return $output_shortcode;
  
  echo do_shortcode("$output_shortcode");
}
add_shortcode( 'testo-personalizzato', 'get_shortcode_testo_personalizzato' );
#2289617

Minesh
Supporter

Languages: English (English )

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

I got it but I do not know what values returned by function flrt_selected_filter_terms();.

Do you see every values returned and you assigned is correct? Either I will require admin access details to check your issue or duplicator copy of your site. Please let me know what mode you would prefer.

#2289677

flrt_selected_filter_terms simply returns slugs.
I want to grant you access

#2289679

Minesh
Supporter

Languages: English (English )

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

Can you please share details where exactly you have added the view at what section? Please share screenshot and problem URL.

*** 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 have set the next reply to private which means only you and I have access to it.

#2289697
#2291729

Minesh
Supporter

Languages: English (English )

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

Unfortunately, the admin access details you shared is not working at this end. Could you please send me working admin access details.

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

#2294139

I used another type of approach.
My issue is resolved now. Thank you!