Home › Toolset Professional Support › [Resolved] How to conditionnaly hide archive loop
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)
Tagged: Views plugin, WordPress Archives
Related documentation:
This topic contains 2 replies, has 2 voices.
Last updated by dubaiM 4 years, 11 months ago.
Assisted by: Minesh.
Tell us what you are trying to do? I would like to hide the loop on this page hidden link (i.e. when no cat is selected) and display it when a cat is clicked (ex on hidden link ). What would you suggest me to do ? Which file could I look into ? I tried to update the archive-annuaire-company.php file but I cannot add a condition to display or not the loop. Either I remove the loop and the first part of the page or nothing at all. Is there any file where I could put my php condition ? I don't understand how and where your plugin is adding the loop and the header information (search bar and picto) on the page. If I could find that I think I would find how to do what my client want. Thanks in advance.
Is there any documentation that you are following? No, I'm trying to code something but I don't know exactly where
Is there a similar example that we can see? I don't think so
What is the link to your site? hidden link
Hello. Thank you for contacting the Toolset support.
I can think of multiple ways.
You can wrap your archive loop with [wpv-conditional] shortcode:
For example:
[wpv-conditional if="( '[wpv-search-term param='annuaire_cat']' ne '' )"] // your archive loop output goes here [/wpv-conditional]
Or
You can also use the standard wordpress hook: pre_get_posts - where you should check if URL param "annuaire_cat" is exist or not and based on that you should adjust your archive's query.
My issue is resolved now. Thank you!