• Resolved strategery

    (@strategery)


    I have created a dropdown field “sort_order” and am attempting to sort my posts. I was able to control the total order by order=”ASC”, but it is sorting by creation date. The syntax I used was orderby=”sort_order” thusly:

    [loop type=”leadership” orderby=”sort_order” order=”ASC”]

    However, it’s still sorting by date. Any ideas on the syntax? Thanks!

    https://ww.wp.xz.cn/plugins/custom-content-shortcode/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    To sort by custom field value, please try:

    [loop type="leadership" orderby="meta_value_num" key="sort_order" order="ASC"]

    If the field is a string (not number) then you can use orderby=”meta_value”.

    I see the documentation is not so clear on this, so I’ll try to improve it. Maybe also simplify the parameters to make it easier to use.

    Thread Starter strategery

    (@strategery)

    That worked! Mine was a string, not a number, so orderby=”meta_value” worked. Thank you so much, and I really appreciate the effort. Now that I am learning the steps, it’s a great and easy system to use.

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

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