Samet Yılmaz
Samet Yılmaz

Reputation: 11

How to Hide a title if one custom field is empty

I'm using advanced custom fields to show complementary products on widget. I add title before complementary products. I want to hide that title when acf field is empty. How can I do it? field name is:tamamlayici_urun_1_gorseli

Upvotes: 0

Views: 670

Answers (1)

Monzur Alam
Monzur Alam

Reputation: 558

You can use the below code I hope it will work. When this field empty then Example:

<?php if( get_field('tamamlayici_urun_1_gorseli') ): ?>
    <p> Title Show </p>
    <p>Field Value: <?php the_field('tamamlayici_urun_1_gorseli'); ?></p>
<?php endif; ?>

Upvotes: 1

Related Questions