Support

Account

Home Forums General Issues Category List with thumbnails Reply To: Category List with thumbnails

  • https://developer.wordpress.org/reference/functions/get_term_link/

    
    <?php
    
    $args = array( 'hide_empty' => '0');
    $categories = get_categories($args);
    if($categories){
    	echo '<ul>';
    	foreach($categories as $category) {
    		$link = get_term_link($category);
    		echo '<li>';
    		$size = "thumbnail";
    		$image = get_field('image', 'category_'.$category->term_id);    
    		echo '<img src="' . $image . '" />'; 
    		echo '<span class="cat-title"><a href="'.$link.'">' . $category->name . '</a></span>';
    		echo '</li>';
    	} 
    	echo '</ul>';
    }    
    
    ?>