I am trying to display some content if one of three conditions is met. However, the content is not being displayed even though the output should be producing a positive result.
<p>author [wpv-post-author format="meta" meta="ID"]</p>
<p>user [wpv-user field="ID"]</p>
<p>friendship [be-get-connection userid1="[wpv-post-author format="meta" meta="ID"]" userid2="[wpv-user field="ID"]" attribute="connection-friend"]</p>
<p>[wpv-conditional if="( $(wpcf-member-privacy-posts) eq 'public' ) OR ( '[wpv-post-author format="meta" meta="ID"]' eq '[wpv-user field="ID"]' ) OR ( '[be-get-connection userid1="[wpv-post-author format="meta" meta="ID"]" userid2="[wpv-user field="ID"]" attribute="connection-friend"]' eq '1' )"]</p>
<h2>Start a Conversation</h2>
<p>[wpv-view name="view-conversation-add" groupid="0" eventid="0"]</p>
<p>or statement with 3 possibilities works</p>
<p>[/wpv-conditional]</p>
<p>[wpv-conditional if="( '[wpv-post-author format="meta" meta="ID"]' eq '[wpv-user field="ID"]' )"]conditional statement with only 1 condition works</p>
<p>[/wpv-conditional]</p>
In the attached screenshot, you'll see that the author and user are both 10, so one of the three conditions in the logic should produce a positive result, but they are not. However, when I remove two of the conditions then the one that should produce the positive result does.
When I remove the [be-get-connection] shortcode then the statement starts working again, so it would appear the problem is with nesting a non-Toolset shortcode into the conditional statement even though that shortcode produces a numerical output (as evidenced in the screenshot). Can you tell me if there are any requirements I need to do when creating shortcodes to help ensure they will work properly when nested inside a [wpv-conditional] shortcode? Thanks.
- Aaron
I've been doing some more research on this and have learned - correct me if I'm wrong - that you cannot nest shortcodes inside of others unless the top-level shortcode calls the nested shortcode through the function do_shortcode(). Am I correct in interpreting that this means it would be impossible to nest my own custom shortcodes inside of Toolset shortcodes? If this is correct, I will need to find another way of working around this.
- Aaron
Hi, first you can try registering the third-party shortcode in Toolset > Settings > Frontend Content > Third party shortcode arguments. This will help get around the do_shortcode issue you mentioned. If this doesn't work, I can take a closer look.
Too easy! That worked. Awesome - sorry if that was a dumb question. I'm sure that's buried in the documentation somewhere and I missed it. Thanks a million. This will make things a lot easier.
- Aaron