I’m trying to get the image in a simple_field trough a taxonomy but I can’t se it, if I take a var_dump I get the title and other stuff like the link the description, but not the image… Does anyone have an idé of how to access this image/simple_field?
I’m using wordpress and php,
$tt = get_terms('product_type', array());
foreach ($tt as $term) :
print $term->name. ": ";
$q = new WP_Query(array(
'post_type' => 'ep-produkter',
'post_status' => 'publish',
'posts_per_page' => -1, // = all of 'em
'tax_query' => array(
'taxonomy' => $term->taxonomy,
'terms' => array( $term->term_id ),
'field' => 'term_id',
),
));
$first = true;
foreach ($q->posts as $item) :
var_dump($item);
print '<a href="'.get_permalink($item->ID).'">'
.$item->post_title.'</a>';
//here i want to echo the img
endforeach;
endforeach;
you can use following function in your for loop to print the featured image of post :
or else, you can get the image url and display the image using img tag like this :