How to order WordPress Posts using a Custom Field value

Order the WordPress custom post types by a Custom Field value has never been easier since the latest version of Advanced Post Types Order plugin. Forget about long codes, template files, error messages and lots of tries, just use a simple interface, chose the options and the plugin does the work for you on the fly! Yes, that’s right you don’t need to know anything about programming to control that.

Here is the simple way to follow to achieve this:
Within the custom post type re-order interface chose the required Taxonomy, in our case Categories, then select a Term, in my example a category named Culture / Entertainment.

Chose Automatic Order and select the Custom Field option from the list. In the Custom Field Name type in the post meta name you need to sort on

advanced-post-types-order-custom-field-usage

Click Update and you are done.


  • Tim

    Is this functional for any post types or only for Posts?

    • admin

      All default/custom defined WordPress post types are supported for this feature to be used along with.

    • nspcode

      This will work for any WordPress custom post types, either default (post, pages) or custom defined.

      • daniel_c_long

        If I’ve created my post types using the WordPress register_post_type() function, is there a parameter I need to add in to that code to allow your plugin to work?

        • nspcode

          There are no additional requirements for the Advanced Post Types Order plugin to work with your custom post types no matter the way you create those, either through code using register_post_type() or by using a custom plugin

          • daniel_c_long

            Thanks for your reply.

            That’s odd, the post types I’ve created using Custom Pot Type UI plugin show the re-order menu, but the ones I’ve created using a function don’t and not sure why.

          • nspcode

            You must be using the wrong hooks to register your post types, check this page for more info

          • daniel_c_long

            Yea, thats what I’m using. The problem was my post type was set to ‘hierarchical’ => true, when it needs to be ‘hierarchical’ => false.

            May have been my error if this is in the plugin documentation.

          • nspcode

            Daniel are you sure you use the Advanced Post Types Order plugin? As it support both hierarchical and non-hierarchical structures.

          • Javier Ordinola

            The hierarchical only work with the premium version.

  • ddd

    Hi,

    I use wordpress 3.5.1

    I have this error when i click the update button to reoder my custom type post in admin (wp-admin/load-script.php – jQuery v1.8.3) :
    Error: cannot call methods on sortable prior to initialization; attempted to call method ‘serialize’

    Can you help me ?

    • nspcode

      Hi,
      Please download the latest plugin files using the personal link you got when bought the plugin which will fix the problem.

      • ddd

        Hi,

        It resolved the problem,

        thanks

  • jeremiah

    Will this support sorting by custom attributes?

    • nspcode

      Presuming your attributes are saved as postmeta data (however there is no other way to do that by WordPress default) you will be able to sort by that.

  • Mark

    Hi, I have added this plugin and reordered using tags but for some reason it is still not reordering in the way I’d like; only in descending date order. Any ideas why? http://roselandonline.co.uk/Cornwall_Roseland_Peninsula/arts-crafts/

    • nspcode

      Hi Mark,
      Is the Autosort functionality set as ON? Otherwise try to include ‘orderby’ => ‘menu_order’ within your theme file query. More details can be found at http://www.nsp-code.com/advanced-post-types-order-api/sample-usage/
      If still not working please get in touch with use through contact and we will check into this.

  • moonmist

    The new posts are going to the bottom of the sorted list, how do I place them at the top?

  • ali eliad

    can I add a header and a picture to every title?

    • nspcode

      If you mean to create a header and picture information for every post as custom fields, then sort by those, Yes it will work.