I have five categories for a custom post type, additionally I have installed a plugin to enable upload image to each category detail, actually I can get show list of categories with details. I need to show a list like the follow structure:

Image Category
Category Name One
This is the category description for category one

Image Category
Category Name two
This is the category description for category one

This is my acual code:

$customPostTaxonomies = get_object_taxonomies('products');

                if(count($customPostTaxonomies) > 0)
                     foreach($customPostTaxonomies as $tax)
                         $args = array(
                              'orderby' => 'name',
                              'show_count' => 0,
                              'pad_counts' => 0,
                              'hierarchical' => 1,
                              'taxonomy' => $tax,
                              'title_li' => '',
                              'hide_empty' => 0

                         wp_list_categories( $args );

With this code I only archive print list of categories in bullet but without any detail.

2 Answers 2


Use this instead of wp_list_categories( $args );

wp_list_categories( $args ); 

It will display the category with formatted results like <ul><li>

$categories = get_the_category();

This will returns the all category assigns to the current post and store in $category variable.

Then you can display as in you listed format

$page_custom_image = get_field("your_custom_field_name", "texonomyname_" .$category->term_id);
  • Please don't post text as code. Text is text, not code. Also, please correct your markup. It is a mess Jun 23, 2015 at 8:01

Following code will fetch custom taxonomies named products. Array of taxonomy object will be returned. Use foreach for loop. In the following example, taxonomy name and description is printed out.

$customPostTaxonomies = get_terms( 'products' );
if ( ! empty( $customPostTaxonomies ) ) {
  foreach ( $customPostTaxonomies as $key => $tax ) {
    echo $tax->name . '<br />';
    echo $tax->description . '<br />';

If you have installed other plugin which allows to upload image for taxonomy, please read documentation of that plugin and fetch image accordingly in the loop. You could get taxonomy ID from $tax->term_id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.