a client ask this : display random categories with images.
Im using this code to display Random wp_list_categories on the sidebar :
<?php
//display random sorted list of terms in a given taxonomy
$counter = 0;
$max = 5; //number of categories to display
$taxonomy = 'category';
$terms = get_terms($taxonomy);
shuffle ($terms);
//echo 'shuffled';
if ($terms) {
foreach($terms as $term) {
$counter++;
if ($counter <= $max) {
echo '<p><a href="' . get_category_link( $term->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a></p> ';
}
}
}
?>
and i’m using this plugin to add images to my categories :
https://wordpress.org/plugins/categories-images/
Question is : How Can I hack the first code to display images with categories ?
Thank you so much for any help 🙂