I want to get all categories in a new page which doesn't include any post. I tried wp_list_categories(); function. But it show only "No category" message. How do I do it?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
migrated from stackoverflow.com Feb 24 '11 at 23:08
|
This will only display the categories if there are posts associated with them, make sure that there are posts in your WordPress database. However, you might try:
which will override that functionality. |
||||
|
|
|
This code will show and unordered list with the name of the category and the count the total posts containing.
Retrieves the 100 first categories (you can change the 100 for any number you want)
and for each of them (even the empty ones) shows cat_name and category_count Copy the code above in the page file you want to dispay the result. You will get some like this:
I hope that could help you. ps: If you need them as links, replace the line
by
|
||||
|
|