Support

Account

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>';
    						}
    					}
    				}
    				?>