How to sort posts by last name (2nd word) on ONE category only?

I have an “author” category that is used as a list to browse multiple posts containing author biographies. I have Smart Category Ordering installed and right now it is sorted by title ascending. Unfortunately there isn’t many options on this plugin and I haven’t found alternatives.

Posts are titled “Firstname Lastname (country)” and I want Lastname (or some custom field value) to determine the post ordering for the AUTHORS category only. I have other categories for news posts I don’t want affected. I’ve seen some ways to do it in PHP but that would affect the entire site.

Related posts

Leave a Reply

1 comment

  1. You have 2 ways.

    First is to write custom SQL query manualy for your request and loop that data.

    Second is to loop your data on standard way, save in multidimensional array, filter, transform and reorder that array via PHP how you need and after that loop that data and print like content.

    Booth ways are good but my recommendation is to write SQL query because is faster and cleaner.

    Like I know WP don’t have a done solution. You need to build by own.

    You need to build custom template for that special category and do that there.