Search code examples
wordpresswp-list-categories

how to remove "categories" title from the top of wp_list_categories(); output


I called my custom taxonomy category using wp_list_categories(); Like this :

<?php 
$post_type = 'listing';
$taxonomy = 'listings_categories';
$orderby = 'ASC';
$show_count = 1;
$hide_empty     = 0;
$pad_counts     = 0;
$hierarchical           = 1;

$args = array(
          'post_type' => $post_type,
          'taxonomy' => $taxonomy,
          'orderby'  => $orderby,
          'show_count' => $show_count,
          'hide_empty' => $hide_empty,
          'pad_counts'  => $pad_counts,
          'hierarchical'   => $hierarchical
              );
?>

<?php wp_list_categories( $args ); ?>

So the output is like it : enter image description here

This is giving me •Categories just under Browse by Locations :

How to remove that ?


Solution

  • Try to add 'title_li' => '', to your $args array.

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

    <?php 
    $post_type = 'listing';
    $taxonomy = 'listings_categories';
    $orderby = 'ASC';
    $show_count = 1;
    $hide_empty     = 0;
    $pad_counts     = 0;
    $hierarchical           = 1;
    
    $args = array(
              'post_type' => $post_type,
              'taxonomy' => $taxonomy,
              'orderby'  => $orderby,
              'show_count' => $show_count,
              'hide_empty' => $hide_empty,
              'pad_counts'  => $pad_counts,
              'hierarchical'   => $hierarchical,
              'title_li' => ''
                  );
    ?>
    
    <?php wp_list_categories( $args ); ?>