How to show taxonomy meta on frontpage?

Over at Google+ I posted the same question and credits go to Alexander Conroy for coding up the correct solution:

/* List all blogs, source example 2: http://codex.wordpress.org/Function_Reference/get_terms#Examples
 *
 * credits Alexander Conroy - https://plus.google.com/u/0/113053085239726972447
*/
$terms = get_terms('blog', $args);
$blog_image_meta = get_option('blog_image');

if (!empty($terms)) {
    foreach ($terms as $term) {
        $meta = isset($blog_image_meta[$term->term_id]) ? $blog_image_meta[$term->term_id] : array(); //term_id
        $image = array_shift(wp_get_attachment_image_src( array_shift($meta['blogimg']), 'thumbnail' ));

        $term_list .= '<article class="blog-list"><figure class="thumb alignleft"><img src="' . $image . '" alt="image" /></figure><p><a href="' . get_home_url() . '/blog/' . $term->slug . "https://wordpress.stackexchange.com/" title="' . sprintf(__('View all articles in %s Blog', 'wys'), $term->name) . '">' . $term->name . '</a></p><p>' . $term->description . '</p></article>';
        }
    echo '<div class="my_term-archive">' . $term_list . '</div>';
}

Leave a Comment

tech