Craft CMS Asked on September 4, 2021
If I have a huge list of TV shows and Movies, many of them have "The" in the title, meaning they all get grouped together if you order by title.
Is it possible to "filter out" a word in entry titles when using orderBy?
{% set entries = craft.entries().section('media').orderby('title asc').limit(24).all() %}
{% set entries = craft.entries().section('media').orderBy("(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc").limit(24).all() %}
worked.
Answered by MarkD on September 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP