• Resolved dhhoyle

    (@dhhoyle)


    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.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @dhhoyle , one way to achieve this is to use custom fields. Look at this WordPress documentation on 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 and modified it a little according to your situation.

    [display-posts meta_key="chapter_order" orderby="meta_value_num" order="ASC"]

    Thread Starter dhhoyle

    (@dhhoyle)

    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.