Answer the question
In order to leave comments, you need to log in
How to get the first element from such a variable?
$icon_url = $icon['guid'];
You need to write something like this:
$icon[0]['guid']
THAT is to get the first element $icon['guid']
Answer the question
In order to leave comments, you need to log in
<?php
$terms = get_terms( [
'taxonomy' => 'services_tax',
'hide_empty' => false,
] );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$icon = pods_field( 'services_tax', $term->term_id, 'images', false);
$icon_url = $icon[0]['guid'];
$icon_thumb = pods_image_url ( $icon_url, 'large', 0, false ) ;
$term_link = get_term_link($term);
?>
<div class="services-item">
<a href="<?php echo $term_link;?>">
<img src="<?php echo $icon_thumb; ?>" alt="">
</a>
</div>
<?php
}
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question