Support » Plugin: Custom Content Shortcode » check if ACF related field is empty

  • Hey there,

    I am trying to check if a [related name] is in fact empty (so I wouldn’t print the header) but [if empty] is not working. Can you help out?

    Generally: What kind of code can I use in combination with fields like repeater or related? I assumed all loop-parameters would work but that does not seem to be true.

    Thanks for any help!

    Best,
    David

Viewing 1 replies (of 1 total)
  • Not exactly what you’re looking for, but this is what I got to work for me:

    <h2>Related Offers, Articles & Itineraries</h2>
    <ul>
    	[if exists]
    		[related type=offer taxonomy=tag,destination,interest]
    			[-if field=end_date value=future]
    				<li>[field title-link]</li>
    			[/-if]
    		[/related]
    		[related type=post,sample-itinerary taxonomy=tag,destination,interest]
    			<li>[field title-link]</li>
    		[/related]
    	[else]
    		<li>Nothing found</li>
    	[/if]
    </ul>
Viewing 1 replies (of 1 total)
  • The topic ‘check if ACF related field is empty’ is closed to new replies.