Answer the question
In order to leave comments, you need to log in
Advanced Custom Fields how to display phone number in widget with div wrapper?
Advanced Custom Fields how to display phone number in widget with div wrapper?
In the widget code, a regular phone is displayed like this:
<?php if ( $myhome_estate->agent->has_phone() ) : ?>
<div class="mh-estate__details__phone">
<a href="tel:<?php echo esc_attr( $myhome_estate->agent->get_phone_href() ); ?>">
<i class="flaticon-phone"></i> <?php echo esc_html( $myhome_estate->agent->get_phone() ); ?>
</a>
</div>
<?php endif; ?>
<h2><?php the_field('heading'); ?></h2>
$term = get_queried_object();
$my_gallery = get_field('my_gallery', $term);
echo do_shortcode($my_gallery);
Answer the question
In order to leave comments, you need to log in
This is how I deduced for authors
Display a group of fields if the User is equal to All
<?php
$args = array(
'role__in' => array( 'administrator', 'author', 'editor' ),
'orderby' => 'display_name',
'order' => 'ASC',
'number' => '6',
);
$authors = get_users( $args );
?>
<?php foreach ( $authors as $author ) :
$user_id = $author->ID;
$phone_number = get_field('user_phone', 'user_'. $user_id);
$phone_number_trimmed = preg_replace("/[^0-9]/", '', $phone_number);
?>
<article class="author">
<?php if ( $phone_number ) : ?>
<a href="<?php echo $phone_number_trimmed ?>" class="user-phone"><?php echo $phone_number ?></a>
<?php endif ?>
</article>
<?php endforeach; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question