I’m seeking to make just a few totally different shows on the house web page of phrases inside sure taxonomies in addition to their picture subject as outlined by ACF.
I’ve been trying on-line and located 2 major other ways to do that and want to initially ask what’s the distinction between the 2:?
WP_Term_Query();
and
get_terms();
That is the code I’ve up to now however it doesn’t appear to work with the_title() and the_permalink().
Additionally, it shows the ACF picture subject of the primary end result however then repeats the identical picture for the others.
The ACF customized picture subject on the time period is ‘artist_thumbnail_image’
<?php
$args = array(
'taxonomy' => 'artist',
'orderby' => 'title',
'order' => 'ASC',
'hide_empty' => false,
'meta_key' => 'artist_featured',
'meta_value' => '1',
'meta_compare' => '==',
);
$the_query = new WP_Term_Query($args);
foreach ($the_query->get_terms() as $time period) { ?>
<?php echo $term->title; ?>
<?php
$featuredartistid = $term->term_id;
$featuredartist = get_field('artist', $featuredartistid);
$featuredartistthumbnailimage = get_field('artist_thumbnail_image', $featuredartist);
$featuredartistthumbnailimagesize = 'thumbnail'; ?>
<a href="<?php echo the_permalink(); ?>">
<?php echo wp_get_attachment_image($artistthumbnailimage, $artistthumbnailimagesize); ?>
</a>
<?php } ?>