3

When sorting by title in channel results, is there a way to ignore the 'The'?

6

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 :) – Alissa J. Robinson May 4 '13 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) – Jason Varga May 5 '13 at 21:37
0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.