4

I've got the following code: wp_list_categories();

It outputs all my categories, however, it makes them the child of a list element, called CATEGORIES.

So, I get an unordered list, like so:

CATEGORIES
* FASHION
* DAILY FASHION CANDY
* TRENDS
* BEAUTY
* ACCESSORIES
* CELEBRITIES
* LIFESTYLE

However, I only need:

* FASHION
* DAILY FASHION CANDY
* TRENDS
* BEAUTY
* ACCESSORIES
* CELEBRITIES
* LIFESTYLE

I'm sure I could remove/hide the word CATEGORIES with JS or CSS, but is there a way to prevent it being there in the first place?

6

Take a look at the parameters in the documentation of wp_list_categories() function.

You need to use this parameter:

title_li

(string) Set the title and style of the outer list item. Defaults to "Categories". If present but empty, the outer list item will not be displayed. See below for examples.

I think it's clear, you just need to pass this parameter as an empty string:

wp_list_categories('title_li=');
  • Thanks, the following works: wp_list_categories('exclude=&title_li='); – tmyie Apr 2 '14 at 8:48
  • 1
    @tmyie, no problem. Note that the exclude parameter is not necesary. I added an example of function call that should work for you... – MikO Apr 2 '14 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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