Skip Navigation

[Resuelto] Show different Views on two different product category archives

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I have two Product Categories and two different Views. I would like to include one View on the Product Category archive for term "pierres-precieuses" and the other View on the Product Category archive for term "diamant".

Solution: Use conditional HTML inside your WordPress Archive that tests the current archive slug:

[wpv-conditional if="('[wpv-taxonomy-archive info='slug']' eq 'pierres-precieuses')" ]
[wpv-view name="pierres"]
[/wpv-conditional]
[wpv-conditional if="('[wpv-taxonomy-archive info='slug']' eq 'diamant')"]
[wpv-view name="test"]
[/wpv-conditional]

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

This support ticket is created hace 6 años, 7 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 20 respuestas, tiene 3 mensajes.

Última actualización por ThierryR232 hace 6 años, 7 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#632633

Hello,

How i can displaying a differents views for differents product category (archive only). I have a view with custom field filter and for X product category isn' t the same filter as Y product category.

Thanx

#634384

You can create one archive each taxonomy.
That archive does display the posts in the related taxonomy term, or whatever other information you add.

Toolset Views cannot create Archives for each term separately.
If you require an archive for each term or more granular control, you have to use the WordPress Template hierarchy and create your own custom templates, where of course you could call Views with our API.
https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/

If you just want one Archive template each Taxonomy you can do that with Toolset Views.
You can add an archive in Toolset > WordPress Archive, and as well there you can add a custom search by fields, for example.

If you want - depending on what Term you currently view in the Front-end - have another custom field search present, you could work with Conditional HTML and wrap the single Custom Fields Search ShortCodes so they display only if the current taxonomy term archive displayed is "xy".
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

For example:

[wpv-conditional if="( '[wpv-archive-title]' eq 'Category: Custom term' )"]
  Filter A
[/wpv-conditional]
[wpv-conditional if="( '[wpv-archive-title]' eq 'Category: Uncategorized' )"]
  Filter B
[/wpv-conditional]

These conditions can be added with the "Conditional Output" that you'll find in every Text Editor as long Toolset is active.

#639903

thanks for your answer.

I don't understand because ther is only one archive product. I want just displaying a different content (with their custom fielfd) for the category product X and product Y.
I have or a view X or a view Y, please how i can do this ?

Thx

#639978

It sounds like you want to display View 1 if the product has term A, and display View 2 if the product has term B. Is that correct? If so, then you can use conditional HTML and the "has_term" function like this:

[wpv-conditional if="( has_term( 'term-a-slug', 'taxonomy-slug', [wpv-post-id]) eq '1' )"]
  This post has term A
[/wpv-conditional]
[wpv-conditional if="( has_term( 'term-b-slug', 'taxonomy-slug', [wpv-post-id]) eq '1' )"]
  This post has term B
[/wpv-conditional]

Add the function "has_term" in Toolset > Settings > Frontend Content > "Third-party shortcode arguments" and "Functions inside conditional evaluations"

If you want to use different filter values in the same View, you can use shortcode attributes as described here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#640487

Thanks Christian, I have a lot problem for with toolset interface, there is a video for this operation ?

#640491
has_term.png

I do not think the conditional interface will be able to create this exact conditional for you. Copy + paste the conditional I provided above, then modify the code manually. I don't have a video but I have attached a screenshot showing where to add has_term.

#643336

Hi, my manager received a request for a video conference call. Would you still like to schedule a call so we can help with your other issues?

#643561

if it's possible yes.

#644007

Okay it looks like we currently have availability at 14:30, 15:00, 15:30, or 16:00 GMT+0 on April 11 or April 12. Will one of those times work for you?

#644010

Sorry, I should have said 14:30, 15:00, 15:30, or 16:00 GMT+0 on April 11 or April 12.

#644022

great, 11 April its' ok.

14h30 GMT+0 it's 4.30PM french hours, right ?

#644030

That is correct, Paris time is 4:30PM. We will set up a video conference call and send you the information shortly.

#644137

Thanks

#648446

Hi, can you provide a list of questions you would like to cover in this conference call? We would like to be prepared for the call.

#648451

I have just sent a meeting invitation to the email address associated with your account - info@t...fr. Please let me know if you did not receive it or if I should send to a different email.