Title: Advanced query sorting
Last modified: August 31, 2016

---

# Advanced query sorting

 *  [titanit](https://wordpress.org/support/users/titanit/)
 * (@titanit)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/advanced-query-sorting/)
 * Hello,
 * I have a custom post type ‘Books.’ I want to pull all the books from the posts,
   and sort them alphabetically under the correct Alphabet heading.
 * Example:
 * <div>
    <h1 class=”title-heading”>A</h1> ABook AAABook </div>
 * <div>
    <h1>B</h1> BBook BcBook BdBook </div>
 * <div>
    <h1>C</h1> CBook CcBook CdBook </div> …………….cont.
 * Also, I need to capture any prepositions so they don’t effect the alphabetical
   order, but replace them back in the output
 * Example: The Best Book, filed under B, not T
    Example: A Killer Book, filed under
   K, not A
 * Any help appreciated 🙂

The topic ‘Advanced query sorting’ is closed to new replies.

## Tags

 * [advanced](https://wordpress.org/support/topic-tag/advanced/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [sorting](https://wordpress.org/support/topic-tag/sorting/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [titanit](https://wordpress.org/support/users/titanit/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/advanced-query-sorting/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
