warzone_fz
warzone_fz

Reputation: 482

how to get wordpress categories list with thumbnails?

i am trying to get thumbnails list with their thumbnails images .i tried code below but it only gives categories list . i know there a could do using feed_image but i can't figure out how to do it .please help me i am just a beginner in wordpress

 $args = array(
 'show_option_all'    => '',
 'orderby'            => 'name',
  'order'              => 'ASC',
 'style'              => 'list',
  'show_count'         => 0,
  'hide_empty'         => 1,
  'use_desc_for_title' => 1,
  'child_of'           => 0,
  'feed'               => '',
  'feed_type'          => '',
  'feed_image'         => '',
  'exclude'            => '',
   'exclude_tree'       => '',
   'include'            => '',
   'hierarchical'       => 1,
   'title_li'           => __( 'Categories' ),
  'show_option_none'   => __( 'No categories' ),
   'number'             => null,
    'echo'               => 1,
    'depth'              => 0,
     'current_category'   => 0,
    'pad_counts'         => 0,
     'taxonomy'           => 'category',
     'walker'             => null
        ); 

         echo wp_list_categories( $args );

Upvotes: 0

Views: 2965

Answers (1)

vico
vico

Reputation: 2142

Wordpress category doesn't have a "cat image" built-in.

You will have to add this yourself via changing the core-code or maybe use the description field as a fake string holder for your image path

<img src="<?php echo category_description( $category_id ); ?>" />

You might have misunderstood what feed_image means

http://codex.wordpress.org/Template_Tags/wp_list_categories

feed_image---
(string) Set a URI for an image (usually an rss feed icon) to act as a link to each 
categories' rss-2 feed. This parameter overrides the feed parameter. There is no default
for this parameter.

The other solution is to use a plugin

https://wordpress.org/plugins/categories-images/

Upvotes: 1

Related Questions