Title: Custom Sort Order
Last modified: August 9, 2019

---

# Custom Sort Order

 *  Resolved [dhhoyle](https://wordpress.org/support/users/dhhoyle/)
 * (@dhhoyle)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/custom-sort-order-5/)
 * My blog is in the form of a book, therefore, I do not want to order my post listings
   by date, because I want to keep the posts in book chapter order. Currently, I
   order by post title (for example, 01 Chapter, 02 Chapter, …), but this becomes
   cumbersome when I want to insert a new chapter. If I could order by tags, for
   example, I could attach numerical tags, (like 010, 020, …) with room between 
   for insertions.
    -  This topic was modified 6 years, 10 months ago by [dhhoyle](https://wordpress.org/support/users/dhhoyle/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [davidatbu](https://wordpress.org/support/users/davidatbu/)
 * (@davidatbu)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/custom-sort-order-5/#post-11822387)
 * Hi [@dhhoyle](https://wordpress.org/support/users/dhhoyle/) , one way to achieve
   this is to use custom fields. Look at [this WordPress documentation on custom fields](https://wordpress.org/support/article/custom-fields/)
   for how to add a custom field called, say, “chapter_order”. Then, you can set
   the appropriate value of the custom field for each chapter, and then use the 
   following shortcode to get the proper ordering. Note that I’ve taken the example
   below from the [plugin’s documentation](https://displayposts.com/docs/parameters/#query-parameters)
   and modified it a little according to your situation.
 * `[display-posts meta_key="chapter_order" orderby="meta_value_num" order="ASC"]`
 *  Thread Starter [dhhoyle](https://wordpress.org/support/users/dhhoyle/)
 * (@dhhoyle)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/custom-sort-order-5/#post-11825705)
 * Thanks very much.
 * My Table of Contents now uses:
 * [display-posts meta_key=”chapter_order” orderby=”meta_value_num” order=ASC include_date_modified
   =”true” date_format=” – F j, Y”]
 * to list my chapters without my having to put chapter numbers in the title and
   sort on post title.
 * For the benefit of others, I had not used custom fields before and had to install
   the Advanced Custom Fields plugin to make custom field value setting appear on
   the post edit page.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Sort Order’ is closed to new replies.

 * ![](https://ps.w.org/display-posts-shortcode/assets/icon-256x256.jpg?rev=2940963)
 * [Display Posts - Easy lists, grids, navigation, and more](https://wordpress.org/plugins/display-posts-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/display-posts-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/display-posts-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-posts-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-posts-shortcode/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [dhhoyle](https://wordpress.org/support/users/dhhoyle/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/custom-sort-order-5/#post-11825705)
 * Status: resolved