reordering categories ?
-
Searched and couldn’t find anything.
They are presently ordered by ID number, I want to reorder them alphabetically.
https://wargame.drivein-jim.net/
Is there an easy way to do this ?
Thanks
-
Look at the ‘sort_column’ parameter:
https://codex.www.ads-software.com/Template_Tags/list_cats
https://codex.www.ads-software.com/Template_Tags/wp_list_catsHmm. Wouldn’t sort_column be it ? that sorts on ID or name.
and set sort_order to ‘desc’ would get it alphabetized ?
I’m not a php/database person.
You jumped the gun on my edit.
;)
Just set ‘sort_column’ to name.No problem.
As tired as I am, I’m surprised I caught it at all.
edit:
I couldn’t find list_cats in index.php, and there isn’t a templte.php
Where is it ?
I’m using 1.2
No wp_list_cats either?
Shouldn’t be too far down from
<div id="menu">
, towards the end of index.php.got wp_list_cats();
edit: got it.
added ‘sort_column=name’ in the () above.
works now.
I’m trying to piece this together, but I’m missing something.
I reviewed both links in the codex referenced above, but I don’t understand how to implement the parameters.
What I’m wanting to do is:
a) sort my category list alphabetically
b) have the number of posts within each category appear in ( )’s next to the category nameI’ve tried:
<?php list_cats(); ?>
and,<?php list_cats(FALSE, ' ', 'name'); ?>;
and,<?php wp_list_cats('arguments'); ?>
all of which are examples in the codex. The results: no change. I made the changes in my sidebar.php. I’m using WP v1.5.
Any help is very much appreciated. ??
I’ve got mine in alpha and showing the # of posts (I’m also excluding 2, so you would need to get rid of that part).
Mine says:
<?php wp_list_cats(‘sort_column=name&optioncount=1&exclude=8,10’); ?>Thanks, oriecat. So I entered
<?php wp_list_cats('sort_column=name&optioncount=1'); ?>
into my sidebar taking into account the exlusion part and it’s still having no affect.
Two things:
1. According to the codex (https://codex.www.ads-software.com/Template_Tags/wp_list_cats) it defines “optioncount” as not displaying the count of posts in each category. So could you help me understand what the value you had in there (1) does?2. I didn’t have this problem with Kubrick; I noticed it when I changed to Blix. I’m not blaming Blix, just pointing this out in case it might spark an idea for anyone reading this. Maybe it’s doing something that’s different than the way Kubrick is doing it. Just guessing, but inexperienced with php as I am, I don’t see things the way a php expert might see them (yet). ??
Here’s my test blog where I’m trying things out: https://familywebwatch.com/blog_test/
EDIT: Oh and btw, did try
<?php wp_list_cats('sort_column=name'); ?>
, but no change either. ??On question 1, the default behavior for the optioncount is off, or zero, so the 1 is to turn it on.
I just copied my code directly from the first example on the wp_list_cats codex page, changing my excludes. It seems very strange that it wouldn’t work for you! I don’t know if it would make a difference, but it does show it enclosed in ul tags (and mine is too) did you do that?
Strange indeed. The code in my sidebar.php is
<h2><em>Posts by Category</em></h2>
<ul class="categories">
<?php wp_list_cats('sort_column=name'); ?>
</ul>If I understand your last question correctly, the code is within ul tags. Could it be that there are no li tags in the code above?
<h2><em>Categories</em></h2>
<ul class="categories">
<li><a href="https://familywebwatch.com/blog_test/category/general/" title="View all posts filed under General">General</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/parents/" title="View all posts filed under Parents">Parents</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/teens/" title="View all posts filed under Teens">Teens</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/sexual-predators/" title="View all posts filed under Sexual Predators">Sexual Predators</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/identity-theft/" title="View all posts filed under Identity Theft">Identity Theft</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/netiquette/" title="View all posts filed under Netiquette">Netiquette</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/internet-safety/" title="View all posts filed under Internet Safety">Internet Safety</a></li>
<li><a href="https://familywebwatch.com/blog_test/category/kids/" title="View all posts filed under Kids">Kids</a>
</li>
</ul>The li’s are added by the tag itself.
I dunno ?? What if you remove your class=categories, so it is just the ul? I’m grasping here
I believe it’s a bug. Check out this post: https://www.ads-software.com/support/topic.php?id=28667#post-161194.
Man, this is frustrating. ?? I tried removing the class=categories, but no change.
I’m grasping, too, but I’m wondering if this has something to do with “Pages” not working either. I could create pages with no problem, but they just wouldn’t show up in the “Pages” section in my sidebar. I was pointed to https://mosquito.www.ads-software.com/bug_view_advanced_page.php?bug_id=927 where it describes this in more detail. I haven’t tried making the change it suggests, and I can’t say for sure that it’s even related. However, I’m good at brainstorming. ??
Thanks again for your help, oriecat. If you have any other suggestions, I’m open to them, but I’ll keep plugging away at it and post back if I find anything new.
Download this file:
Use it to replace the one in your wp-includes/ directory. Until you do, there’s no way to know if the problem you’re having is not due to the bug in the original 1.5 release.
- The topic ‘reordering categories ?’ is closed to new replies.