list_cats changed in v1.5.1 ?
-
I had this in v1.5.0 and it worked perfectly:
list_cats(FALSE, '', '', '', '', TRUE, '', TRUE);
After upgrading, I get this:
WordPress database error: [Unknown column ‘cat_’ in ‘order clause’]
SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM wp_categories WHERE cat_ID > 0 ORDER BY cat_Warning: Invalid argument supplied for foreach() in /chroot/www/finalgear.com/html/wordpress/wp-includes/template-functions-category.php on line 304
* No categoriesRemoving the parameters fixes it. Anyone else have this problem?
-
Seems this was my fault. I needed to specify what to sort by (either ID or name). No idea why I had it as
''
before. Stupid me.Now using this and it works perfectly. 🙂
list_cats(FALSE, '', 'ID', 'asc', 'index.php', TRUE, FALSE, TRUE);
And now that I think of it, I could probably just use
wp_list_cats
to avoid having to define all of those parameters. 🙂[edit]
Yep,
wp_list_cats('optioncount=1');
works great. 😀[/edit]
All I did was add this code to my right column.
<div class="rightsideSection">
<h4>Categories</h4>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=1'); ?>
</ul>
</div>
This sorts it in hieraarchical form. Just reverse the 0 and 1 to make it sort by name.Yeah, I just wanted to turn post counts on: http://www.finalgear.com/ 🙂
To brianbonner:
I used the following code. The category doesn’t show hieraarchical form.-
<?php wp_list_cats(‘sort_column=name&optioncount=0&hierarchical=1’); ?>
Any idea why?
where did you place it? inside the parenthesis the apostrophy looks different in your post, I don’t know why. I would like to look at your souce what is the url?
It looks different (here) because s/he didn’t use the proper backticks for code:
<?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=1'); ?>
Viper,
this code
<div class="rightsideSection">
<h4>Categories</h4>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=1'); ?>
</ul>
</div>
Will do what you want for categories. See my blog
http://uncooperativeblogger.comWell it will sort by hierarchy alphabetically and give a post count. If you don’t have, or plan to have, sub categories then turn the heiracrhy value off(to zero)
- The topic ‘list_cats changed in v1.5.1 ?’ is closed to new replies.