Tell us what you are trying to do?
I was trying to use the wpv–conditional shortcode inside a post. But apparently that is only possible inside a view, template or archive. Is there a way to display post fields/post metas conditionally inside a post?
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?
Hi,
Thank you for contacting us and I'd be happy to assist.
The Toolset conditional shortcode 'wpv–conditional' should work from the post's content/body too, without any content template or view.
Here is a link to the documentation on the topic:
https://toolset.com/documentation/legacy-features/views-plugin/conditional-html-output-in-views/
In case, it is not working, please share the exact steps and the details and I'll be in a better position to troubleshoot this.
regards,
Waqar
Hi Waqar, thanks for your reply. I can confirm that it works in the post's content. Now we tried to use it inside a custom layout hook with astra theme (hidden link). This astra custom layout hook can then dynamically be inserted in the desired post's content (which is a really nice feature of the astra theme). Unfortunately that doesn't work in conjunction with the wpv-conditional tag. It seems the wpv-conditional shortcode fires too early. That's why the wpv-conditional tries to check the astra custom layout hook instead of the post where the custom layout hook is inserted. Other shortcodes like [wpv-post-title] do work inside astra custom layout hooks. Do you have any idea how to get to work the [wpv-conditional] too?
Thanks for writing back.
I don't have much experience with the 'custom layout hook' feature from Astra, but their documentation mentions that the execution priority can be adjusted:
hidden link
Can you test by increasing the priority number, to further delay the execution?
Another alternate that you can try is to add conditional statements inside a Toolset content template and then load that template in the custom layout hook, through the 'wpv-post-body' shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body