Home › Forums › General Issues › $variable code not working › Reply To: $variable code not working
Thanks for your help Elliot. All sorted now.
<?php
// INCLUDE ONLY THE MOST IMPORTANT PHOTO TAGS IN THE LIST.
// 51 - Architecture
// 52 - Scapes
// 29 - UK
// 43 - Interiors
// 36 - Personal
// 38 - Commercial
// 30 - People
// 'orderby' => 'name', // sort by name or count (Alphabetical) or count (Most used)
// 'order' => 'ASC', // in ASCending or DESCending order
$types[0] = 'media-tags';
foreach ($types as $type) {
$terms = get_terms($type, array('name_like' => "a", 'order' => 'DESC', 'orderby' => 'count', 'include' => '51,52,29,43,36,38,30') );
if ($terms) {
foreach($terms as $term) {
$image = wp_get_attachment_image_src(get_field('term_thumbnail', 'media-tags_'.$term->term_id.''), 'thumbnail');
$genreDescription = get_field('genre_description', 'media-tags_'.$term->term_id.'');
$moduleClass = get_field('moduleclass', 'media-tags_'.$term->term_id.'');
echo '
<li class="'.$moduleClass.' block project">
<a href="/archive/photographs/'.$term->slug.'">';
echo '<img src="'.$image[0].'"/>
<div>
<div>
<h2>'.$term->name.'</h2>
'.$genreDescription.'
</div>
</div>
</a>
</li>';
}
}
}
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.