I'm using the Taxonomy Images plugin to try to pull in the category images for custom categories on a page that displays all the categories my site has. For some reason, this code outputs the correct names and descriptions, but will only show one category image.
I'd like the images to do what the other category features do, populate with the appropriate data for each category and display all the categories on the page. If I use echo wp_get_attachment_image( $imgs[$id], 'thumbnail' ); it publishes all of the images, but if I change that from echo to make it a variable, it only displays one image.
$imgs = get_option( 'taxonomy_image_plugin' );
$categories = get_terms('portfolio_category', array('orderby' => 'id', 'hide_empty' => 0));
foreach ( $categories as $category ) {
$id = $category->term_id;
$img = wp_get_attachment_image( $imgs[$id], 'thumbnail' );
}
for($i=0; $i<count($categories); $i++)
{
echo('<h2>'.$categories[$i]->name.'</h2>');
echo($img);
echo('<p>'.$categories[$i]->description.'</p>');
}
I guess that I'm just confused as how to add a counter like [$i] so that this code outputs the correct category images. Any help would be much appreciated.
$cats = pexeto_get_taxonomy_children('portfolio_category', $cat_id);. Thepexeto_get_taxonomy_children()is a Theme function, not a core function. – Chip Bennett Dec 10 '12 at 20:01