[Résolu] Insert conditional HTML inside wpv-for-each
This support ticket is created Il y a 8 années. 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.
I'm sorry, but currently, there is no way to insert a condition in the [wpv-for-each field] shortcode.
Our documentation state this:
"Note: wpv-conditional shortcode won’t work inside a wpv-for-each shortcode" https://toolset.com/documentation/views-shortcodes/#wpv-for-each
If you know in advance how many item you are going to have in this view, you can use the [wpv-item] with index=x attribute and add some HTML before the last item. Something like that:
If this is not the case and you can not anticipate how many items you will have then you can target the last element with CSS and insert some text before the last element.
Take a look at the following links that explain how to do it with CSS: hidden link hidden link
I've heard from our developers that there is a feature request to add an attribute index=last to [wpv-item] then everything would be easier for you.
Unfortunately, I can not say when this feature will be available.
Please let know if you need any more information regarding the issue that you bring here in this thread.