Skip Navigation

[Resolved] Apply filter for highlited articles (mises de l’avant)

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to use a conditional that tests whether or not a post is sticky (Mettre cet article en avant sur la page d'accueil).

Solution:
You can use WordPress's is_sticky function.
1. Go to Toolset > Settings > Frontend Content > Functions inside conditional evaluations, and enter is_sticky.
2. Use this conditional format to test if the current post is sticky:

[wpv-conditional if="( is_sticky() eq '1' )"]
This post is sticky
[/wpv-conditional]

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/

This support ticket is created 5 years, 8 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
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)

This topic contains 4 replies, has 2 voices.

Last updated by francoisP-5 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1083077

I have a view on my home page wich show my 3 last "Nouveautés".
It is using the article content type.
In the view, I would like to apply a filter on the highlited option (it's at the visibility level)

Can I use a secondary filter option ? If yes, where do I find it?
Or can II use a conditional tag in my loop item field?

#1083231
Screen Shot 2018-08-14 at 5.24.09 PM.png

Hi, I'm sorry but I can't really understand what you're asking. Can you show some screenshots or pictures that describe what you want to accomplish?

In the view, I would like to apply a filter on the highlited option (it's at the visibility level)
I'm not sure I understand what you mean by "highlighted". What makes a post "highlighted", and what is a visibility level? Is there a "highlighted" taxonomy term, or a custom field? Please show me in wp-admin how you highlight a post.

Can I use a secondary filter option ? If yes, where do I find it?
You can add multiple Query Filters to a View. Click "+ Add a Filter" in the Query Filter panel to add more than one filter (see the screenshot). If you cannot find the Query Filter panel, scroll to the top right corner of the screen and click "Screen Options". You can activate the Query Filter panel here.

Or can II use a conditional tag in my loop item field?
You can use conditional HTML in the Loop to show or hide pieces of content. Here is some information about conditional HTML:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/

#1083747
visibility.jpg

Thanks for the info. Actually, what I am trying to trap is the highlited parameter in the capture picture below. Is there a way to identify this? That way, I could you an IF condition somehow.

#1083889

You can use WordPress's is_sticky function.
1. Go to Toolset > Settings > Frontend Content > Functions inside conditional evaluations, and enter is_sticky.
2. Use this conditional format to test if the current post is sticky:

[wpv-conditional if="( is_sticky() eq '1' )"]
This post is sticky
[/wpv-conditional]
#1083955

Tx a mil guys, it did the job 100%.
Have a nice day!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.