Call a specific category image?
-
I’m creating a featured section and I’d like to pull in a featured category name, description and taxonomy image for the category I specify. How can I set this up so all I have to do is swap out the ID or slug of the featured category?
Currently I can get the name and description, but not the taxonomy image:
$taxonomy = 'countries'; $terms = get_terms($taxonomy, 'slug=united-states'); if ($terms) { foreach($terms as $term) { echo '<h2>' . $term->name . '</h2><p>'. $term->description . '</p> '; print wp_get_attachment_image( $term->image_id, 'Flags' ); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Call a specific category image?’ is closed to new replies.