Skip Navigation

[Résolu] Exclude category is not working

This support ticket is created Il y a 3 années et 7 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

Ce sujet contient 9 réponses, a 2 voix.

Dernière mise à jour par Shane Il y a 3 années et 7 mois.

Assisté par: Shane.

Auteur
Publications
#2005579

Hello,

I'm using [wpv-post-taxonomy type="category" exclude="afficher-sur-homepage"  format="link" show="name" order="asc"]
but the exclusion is not working.

None of the code fixes suggested on this forum (since 2013 till now) worked.

#2005585

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Mario,

Thank you for getting in touch.

Our shortcode doesn't have an exclude attribute as you can see from our documentation below, so adding an exclude attribute won't produce any result.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472

Can you explain what do you mean by exclude a category ? Is it that you want to exclude a term from being listed out by the shortcode ?

Please let me know.
Thanks,
Shane

#2005605

Yes, that's what I want to achieve.
Here's an article: lien caché
I want to exclude the term "afficher-sur-homepage" from the second circle in yellow. It should list all categories of the current article, except one (afficher-sur-homepage)

#2005883

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Mario,

There are 2 ways we can do this, one would involve no custom coding and will involve just creating a view with the classic editor and then using our conditional shortcode to filter out the term that you don't want to display,

The other way is to use custom coding to filter out the taxonomy that you don't want displaying from the [wpv-post-taxonomy] shortcode.

However In order to proceed I would like to know if this is going to be something that will be dynamic or will it just be affecting this page only?

The reason why I asked is because we won't be able to make it dynamic if it is something that you will be adding to a content template that is shared by many posts.

I can assist with the method that involves creating a view that will replace the [wpv-post-taxonomy] shortcode. We will use the view to display the taxonomy term.

To proceed you will first need to have the classic editor enabled for views. Enabling the classic editor can be done by going to Toolset->Settings->Editing Experience and select the 3rd option and refresh the page.

Once you've done this go to Toolset -> Views and create a new view, then select Taxonomy for "Content Selection" and then select Category.

Now you will scroll to the Query filter area and then add a query filter for Taxonomy Term and then set it to "Set by the page where this View is inserted"

Finally go to the Loop Editor and click on the Loop wizard to add the fields that you want to display in the view.
Ensure " Use a Content Template to group the fields in this loop" is not checked.

Then click finish.

Once all this is done then you will use the following conditional to not display the taxonomy you dont want to show.

[wpv-conditional if=" ('[wpv-attribute name='term']' ne '[wpv-taxonomy-slug]') " ]

My content goes here

[/wpv-conditional]

Then you will call the view using the shortcode for the view.

[wpv-view name="my-view" term='afficher-sur-homepage']

Please let me know if this helps.
Thanks,
Shane

#2005911

Hi Shane,

I understand the idea, however, I'm doing something wrong. Here's my loop code:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>

[wpv-conditional if=" ('[wpv-attribute name='term']' ne '[wpv-taxonomy-slug]') " ]
[wpv-post-taxonomy type="category"]
[/wpv-conditional]

</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

and here's how I'm calling the view: [wpv-view name="yellow-bar-article-exclude-afficher-sur-homepage" term='afficher-sur-homepage']

On the front-end, it's still displaying the unwanted category: lien caché

Thank you for your help!

#2006457

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Mario,

Would you mind allowing me to have admin access to the site so that I can see what has been done?

I've enabled the private fields for your next response.

Thanks,
Shane

#2006467

I forgot to mention, only the first 3 articles belong to that category (afficher-sur-homepage)
Here's an example: lien caché

#2006471

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Mario,

Thank you for credentials, i've tried to log into the site however the site credentials aren't working.

Can you check on them and let me know if the credentials work for you.

Thanks,
Shane

#2006473

my bad, username is shane-tmp

#2006491

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Mario,

This should now be working fine.

The issue was that in your view you still had the shortcode [wpv-post-taxonomy] when it should be [wpv-taxonomy-title]

Please let me know if this helps.
Thanks,
Shane