The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

How to choose the first letter of the Last word when sorting alphabetically (4 posts)

  1. Joshuwar
    Posted 6 years ago #


    I'm using WordPress as a CMS for an agency website, where I'm using categories titled with people's names to collate seperate posts about them. So there might be a category called Bob Dylan, which pulls up news, works, and a biog from other categories.

    I'm using wp_list_cats to present a simple list of all these people. This orders the categories by name, alphabetically by default. That's fine, but I'd like to be able to sort by surname instead- ie. using 'Dylan' instead of 'Bob'.

    So I presume I'll need to use some kinda string manipulation to find the last seperate word in a category title, and use the first letter of that word to determine the alphabetical order, rather than the first letter of the entire string.

    Unfortunately I'm at a loss with where to start with scripting something like this, and I've not been able to find anything similar to guide me.

    Any nudges in the right direction would be extremely helpful...

  2. Joshuwar
    Posted 6 years ago #

    nobody got any thoughts on this?

  3. brduncan
    Posted 6 years ago #

    I could use this same thing. Anyone have thoughts?

  4. deadlycomputer
    Posted 6 years ago #

    simple php substring maniuplation

Topic Closed

This topic has been closed to new replies.

About this Topic