How do you sort "the_category" tag alphabeticall (5 posts)

  1. jumbo
    Posted 11 years ago #

    It appears that wordpress is sorting it by category ID. The only available parameter is to specify a separator.
    Keep in mind, I'm not referring to the "list_cats" tag which has about a dozen a dozen parameters and exists outside the loop. I'm referring to the "the_category" tag which exists inside the loop and is specific for each entry.

  2. chuyskywalker
    Posted 11 years ago #

    Line 10,12,12 are what you are looking for, I think...
    WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID

    change to
    WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID ORDER BY category_nicename

    Should do the trick.

  3. jumbo
    Posted 11 years ago #

    Thanks, but it didn't work.

  4. RyuMaou
    Posted 11 years ago #

    I got it to work by changing the PRIMARY Index on the wp_categories table in the database. The tricky part was getting all the indexs right.
    First, I changed the PRIMARY to a simple index and renamed it.
    Next, I changed the cat_name index from Unique to Primary.
    Finally, I added the cat_name index, as a Unique index, back into the indexs for this table.

    Worked like a charm, but if you're even a little hesitant messing with the SQL database, I don't reccomend trying it.

  5. davidhosier
    Posted 10 years ago #

    This plugin sorts the category list outputted by the_category() in alphabetical order.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.