Extract image url associated to a category
I found what I needed: $category = get_category( get_query_var( ‘cat’ ) ); $cat_id = $category->cat_ID; $images = get_posts( array(‘post_type’ => ‘attachment’, ‘category__in’ => $cat_id)); if ( !empty($images) ) { foreach ( $images as $image ) { $image_url = $image->guid; } } else{ $image_url=””; } First I got the category, and current category ID I’m in. … Read more