Documentation for Conditionals

Is there any detailed documentation for Conditionals?

I’ve found a video from Adam (Conditionals in Pinegrow for WordPress | Pinegrow Web Editor) and 1 page from Pinegrow (Block Condition | Pinegrow Web Editor). It’s not quite enough to help me know how to use them.

I’m trying to hide the social media icons in the site footer based on whether or not there are Values for each corresponding social page in an ACF Options Page (see attached).

Thanks!

Add this code snippet (change filed names) to inc/custaom.php

function load_social_media_acf_options() {
    if (function_exists('get_field')) {
        $GLOBALS['twitter_handle'] = get_field('twitter', 'option');
        $GLOBALS['facebook_handle'] = get_field('facebook', 'option');
    }
}
add_action('after_setup_theme', 'load_social_media_acf_options');```

2. Add if Option with condition

![pinegrow|586x500](upload://p01zxpSmYJ123o8gAZiFZSY1w8F.png)

Thank you for your reply.

Is there supposed to be a screenshot?

Also, is there a way to do this using the Conditional WordPress Actions instead of the way you suggested?

Still trying to wrap my head around how Pinegrow works.

I use more the pinegrow theme converter, but probably it is exactly the same on WordPress builder. There is a if checkbook right where you link the content with the field.

Check this link:

Showing the element only if value is set

@sirojuntle I appreciate the reply. I don’t think this is what I need though… I’m not using the Block Smart Actions - Block Attributes that has the “If” checkbox. See attached.

Screenshot 2024-04-29 at 12.53.09 PM

Sorry for my confusion!

Try this suggestion, it should work:

Select the element and add the first Conditional option: “if options”

In the “if options” panel field, just put get_field('instagram') replace the instagram with whatever is the name of the field you created in the ACF.

(If it work) Repeat it one by one changing the field name.

The block conditions may work, but it is new for me. You could test to follow the first video where they tell how to show or not a h2 title if it has a link. If your theme does not generate a <a anchor> automatically, it should work too, but I guess the above suggestion might be more simple and clear).

Hey @sirojuntle , thanks for the additional help.

Wasn’t quite what I needed but it got me to the right destination.

Here’s what worked (in case anyone else needs this that doesn’t naturally know the solution and doesn’t want to spend hours on something that should have taken minutes…)

On the parent element, in my case the link element, you place 2 actions:

Action #1: “Display ACF Field”. For the Field value, use the value you created in ACF. For Object ID, be sure to use “Options” if you’re using the ACF Option setup like I did. Then in my case I was switching out the Href attribute, so that’s what I selected for Replace.

Action #2: “If Options” conditional (the 1st one under “Conditionals”. You need to then use get_field( 'youtube_link', 'options' ). The “get_field” part is to get the ACF field. The first value in the parenthesis is the same name of the field for Action #1. Then you have to have the ‘options’ bit in there otherwise it won’t work. My guess is that it’s not pulling from the “ACF Options” page and probably looking for an ACF field on the page/post by that name, which doesn’t exist.

Attached is a screenshot of the setup.

1 Like