Skip Navigation

[Resuelto] Conditional tag with Limit not working

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

Problem:

Add a field filter to post view.

Solution:

It does not need [wpv-conditional] shortcode, instead, you can add a filter on custom field "featured-accommodation", for example:

https://toolset.com/forums/topic/conditional-tag-with-limit-not-working/#post-1291431

Relevant Documentation:

https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Etiquetado: ,

This topic contains 4 respuestas, has 2 mensajes.

Last updated by tyeB hace 4 años, 9 meses.

Assisted by: Luo Yang.

Autor
Mensajes
#1291291
Screenshot_2019-07-15 Edit View ‹ Accommodation Margaret River — WordPress.png
Screen Shot 2019-07-15 at 11.48.54 am.png

I am trying to: use a checkbox custom field to select featured posts with a limit of 12

Link to a page where the issue can be seen: see screenshots

I expected to see: A grid of 12 featured posts

Instead, I got: A grid of 12 featured posts for a day, then only 4 appeared, then 1, then 3. I noticed the amount of posts returned was always dependent on the limit, so I set to no limit and they all appeared. The actual result is random, it can happen on any day. A toolset debug report always returned 12 posts, but the display showed random results.

Bug I think.

#1291431

Hello,

In your case, it does not need [wpv-conditional] shortcode, instead, you can add a filter on custom field "featured-accommodation", for example:
Edit the post view you mentioned in screenshot:
hidden link

in section "Query Filter", add a filter:
Select items with field:
featured-accommodation is a number equal to 1

Then it should be able to output 12 posts with field "featured-accommodation" checked.

More help:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

#1292223
Screen Shot 2019-07-16 at 11.01.53 am.png

Hey Luo - that doesn't seem to produce any results 🙁

Have I got the custom field setup correctly?

I resaved some featured posts to check - No items found.

I prefer this method of filtering, but shouldn't my first conditional method of worked anyway?

#1292243

I think you have setup the custom field correctly.

Please check these:
1) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again

2) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1292455

My issue is resolved now. Thank you!

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