Display HTML only if Custom Field has a Value

You can use the “get_sub_field” to test for the subfields. If nothing is returned and they are empty, it won’t show the content associated with the if statement. <?php if ( get_field(‘ingredients-list’) ) { echo ‘<ul class=”ingredientsList”>’; while ( has_sub_field(‘ingredients-list’) ) { echo ‘<li class=”ingredient” itemprop=”ingredients”>’; echo ‘<label for=””>’ . get_sub_field(‘quantity’) . ‘&nbsp; ‘; if … Read more

How to Display ACF Relationship Custom Field as Link to Specific Custom Post?

Finaly, I make this working. I put this in my template: <?php $contacts = get_field(‘list_supplier’); ?> <?php if( $contacts ): ?> <?php foreach( $contacts as $contact ): ?> <a href=”https://wordpress.stackexchange.com/questions/118817/<?php echo get_permalink( $contact->ID ); ?>” target=”blank”><?php echo get_the_title( $contact->ID ); ?></a> <?php endforeach; ?> <?php endif; ?> And here is the filter I am using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)