When sorting by title in channel results, is there a way to ignore the 'The'?
3 Answers
Low Alphabet will let you generate alphabetically ordered channel entries with the option to define ignore words like 'the' and 'a'.
-
Low Alphabet was definitely the way to go. Works perfectly. Thanks, Low! My site is running Low Variables, Search and Alphabet. Pretty sure I couldn't have done this without you :) May 4, 2013 at 12:38
-
Glad I saw this question here. I was looking through old commits to find a core hack I used once. (Low's solution wasn't around at the time) May 5, 2013 at 21:37
For the sake of completeness, I'm posting this.
You could modify the core. Low Alphabet is a better solution, though.
In /system/expressionengine/modules/channel/mod.channel.php, search for:
case 'title' :
$end .= "t.title";
break;
and change it to:
case 'title' :
$end .= "TRIM(leading 'an ' FROM TRIM(leading 'a ' FROM TRIM(leading 'the ' FROM LOWER(t.title))))";
break;
That'll ignore 'an', 'a' and 'the' from the start of titles in channel entries loops.
I've always instructed clients to remove 'the_' or 'a_' from the beginning of the URL title once they punch in the Title; I then sort the display of channel entries by URL title. They haven't seemed to mind it this way. It's good to know there's an addon available that eliminates that small bit of tedium, though.