I am using WordPress to host a conference website at my university, and each breakout session has its own post. I am listing the posts alphabetically by title, using the “
orderby=title” attribute for the
Is there an easier way to exclude “the,” “an,” “a,” and quotation marks (left single & left double) from the alphabetical sort order? Without my ugly hack (below), posts with “The” get lost among the Ts, and quoted titles get dropped to the bottom, etc.
My current method creates problems with titles in the head tags and with the DD Sitemap Generator Plugin. Plus it may create confusion with our non-technical content creators.
My ugly hack involves renaming the post title without the leading characters (ex. “The Post Title” becomes “Post Title”). I then save the leading characters as a custom field (ex. “The ”). Then I reassemble the entire post title by retrieving the custom field with the
c2c_get_customtag from Coffee2Code’s Get Custom Fields plug-in, which only works inside The Loop.
It would be ideal if I could find a method that allows me to just keep “the,” “an,” “a,” etc. in the post title.
- The topic ‘Sort posts by name, but exclude “the,” “a,” “an”’ is closed to new replies.