Tell us what you are trying to do?
I have this in the template of my custum post page:
<h3>Cite this Essay:</h3>
<div class="cite-this">[types field='cite-name'][/types]. <span>“[wpv-post-title]”</span>, <span style="font-style:italic;">Electronic Book Review</span>, [types field="publicationdate" style="text" format="F j, Y"][/types], [types field='doi-ref'][/types].</div>
The last part [types field='doi-ref'][/types] is for a "doi-ref" field I set up to enter a reference url in each post (DOI). But sometimes there is no doi set in a post, which leaves this part of the concatenation blank and ending in ,.
I would like there to be a conditional - if there is no value in the doi-ref field, then enter the current post's url. I don't know the shortcode for the current posts url nor how to set a conditional.
Is there any documentation that you are following?
Trying!
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.
To conditionally display the field's value when it is not empty and show the current page/post URL, when the field is empty, you can replace:
[types field='doi-ref'][/types]
With:
[wpv-conditional if="( empty($(wpcf-doi-ref)) )"][wpv-post-url][/wpv-conditional]
[wpv-conditional if="( NOT(empty($(wpcf-doi-ref))) )"][types field='doi-ref'][/types][/wpv-conditional]
Useful documentation links:
https://toolset.com/documentation/legacy-features/views-plugin/checking-fields-and-other-elements-for-emptynon-empty-values/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-url
I hope this helps and please let me know if you need further assistance.
regards,
Waqar