Sort wordpress posts from A-Z and exclude ‘The’

I current use the following line to list all my wordpress posts from A-Z, but the issue I have with this is that all posts starting with ‘the’ (which are a lot!) are listed under the T (as usual).

query_posts('orderby=title&order=asc&posts_per_page=999&cat=3');

I want to prevent this and show posts beginning with ‘the postname’ as ‘postname, the’ to make the A-Z sorting better.

Read More

How would I achieve this?

Related posts

Leave a Reply

1 comment

  1. I think there are two ways to get this data out:

    • use the query_posts() function, remove the “the” and then resort in PHP
    • Write a custom MySQL query to fetch the data and perform the string replacement

    I think the first solution is best but I don’t know enough about WordPress to know what query_posts() returns so can’t go further with a solution.