ivycat / posts-in-page

Easily add one or more posts to any page using simple shortcodes. Supports categories, tags, custom post types, custom taxonomies, and more
GNU General Public License v2.0
27 stars 19 forks source link

Ability to order by a custom field #39

Open sewmyheadon opened 8 years ago

sewmyheadon commented 8 years ago

(such as created by Advanced Custom Fields)

cyrrill commented 6 years ago

Actually, upon further research, this already supported with standard WP query variables:

[ic_add_posts showposts='10' category='sports' orderby='meta_value_num'  meta_key='sort_custom_field_name_here' order='ASC']

using the special orderby key of "meta_value" or "meta_value_num"

https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

sewmyheadon commented 6 years ago

Howdy @cyrrill,

Thanks so much for reporting back!

We're working on a few updates to the plugin and the docs and will make sure to test and include this so others can benefit too.

Cheers!