Custom Condition

Hey guys,

I have a simple condition:

if (get_the_author_meta('ID') != 1) {
    echo "<h1>TEST</h1>";

It works in a PHP Code block.

I’d like to add that condition to an element, so it only shows when author ID is not 1.

I assume I have to use “If Options” condition, but when I paste “get_the_author_meta(‘ID’) != 1” there, it doesn’t do anything.

What am I doing wrong?

Can anyone help with this? How can apply a condition to an element created in Pinegrow?

@Adryan thanks for bumping up the topic.

Use If options action to create a custom condition:

Source code:

<h1 wp-if-custom="get_the_author_meta('ID') != 1">Heading 1</h1>

generates PHP code:

<?php if ( get_the_author_meta('ID') != 1 ) : ?>
    <h1><?php _e( 'Heading 1', 'author_test_block' ); ?></h1>
<?php endif; ?>
1 Like