WordPress.org

Forums

Custom Query Fields
How to sort by ascending order? (4 posts)

  1. Danjiro
    Member
    Posted 3 years ago #

    im trying to sort posts using custom field numerical values. it will order it by descending values by default but i would like the option of going back and forth between DESC and ASC. Can anyone tell me how to do this with the URL? THANKS!

    http://wordpress.org/extend/plugins/custom-query-fields/

  2. wakingmedia
    Member
    Posted 3 years ago #

    I have the same question -- I see that it defaults to DESC, how do I add ASC?

  3. JoZu
    Member
    Posted 2 years ago #

    custom_query_fields.php

    LINE 39:

    'order' => 'DESC', //[ASC] [DESC]

    change for ASC

    Nice plugin for sort post by price range!

  4. Axenstar86
    Member
    Posted 2 years ago #

    No need to edit the plugin file directly.

    When registering your Query Field just add the sorting into the array:

    register_custom_queryable_field("price", array("dataType"=>"numeric", 'order' => 'ASC',));

    You can only choose between "no sorting" AND ASC OR DESC. Haven't figured it out jet how to switch between ASC and DESC.

    Regards Stefan

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Query Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic