You can use the “orderby” parameter of query_posts.
You must specify your custom field and you must give it a numeric value.
Short example:
query_posts($query_string . "&cat=$que&orderby=meta_value_num&meta_key=your_custom_field")
Related Posts:
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Orderby meta_value only returns posts that have existing meta_key
- ORDER BY custom field value
- Auto sort the wp-admin post list by a meta key
- get_pages sort alphabetically by meta value
- Archive sorting functions by custom fields (front-end)
- Order by custom field date?
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Is it possible to order posts by two meta values?
- Sorting posts by multiple values, combined
- Sort by posts that have a featured image?
- sort search results by custom fields using dropdown
- Sorting WordPress Posts via Custom Field Values?
- Advanced search by two criteria – sort by location and date (ascending or descending)
- Change the sort order for posts to include custom field
- Sort custom post type by multiple custom fields
- Sort alphabetically by custom field
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Sort WP_Query with numeric custom field
- ORDER BY custom field value out of where clause
- wordpress custom loop ascending descending posts by custom field
- Select custom posts by meta_value and sort by a different meta value
- change order of images attached to post
- Sort posts by clicks on download button
- How To Show Get Adjacent Posts If Posts Are Sorted By Custom Field
- Listing the most popular 8 city (custom fields) as used in posts
- How to sort by custom field value?
- Custom Query Fields – Altering Meta Value
- How to order posts by number of Vimeo Likes
- Filter or order based on custom field
- Compare ACF date field (if exists) and post date and order DESC
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Sort posts by custom fields with empty values
- Sort custom fields in admin by last field added
- list pages by custom_field?
- Sort posts after filtering them through multiple taxonomies
- Can’t sort custom column on user.php by number / meta_value_num?
- Order by a meta field in query loop
- Meta Query with AND & OR?
- Adding another state (spam, reject, approve) to wordpress comments?
- WP doesn’t show Array Custom Fields?
- Filter archive.php by custom meta
- How do I search an array stored in a custom-field using WP_Query?
- Custom text-only header
- How to save custom fields for attachments
- Exclude custom post type from search by custom field value?
- Adding Custom Text Area to WooCommerce Product
- Get multiple custom field values in a $wpdb query [duplicate]
- add meta box using function.php
- Order by value in serialized custom field
- Custom image sizes for custom field media uploads
- converting custom field date format
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- Add Paypal Button programmatically
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- Can’t get post ID using wp_insert_post_data
- query usermeta from custom field
- Modifying custom order item meta from admin order view
- Let users track progress by entering a number daily in profile?
- WooCommerce – Adding Custom Fields To Invoice
- Changing themes… and need to move Custom Field content into another field
- Filter Posts on Custom Fields and Show them on a new Page
- How to add a custom field in the advanced menu properties?
- $form_fields from attachment_fields_to_edit returning empty array
- How to link keywords in custom fields?
- Meta query with multiple custom fields for archives page ordering problem
- Adding custom field to post object from custom table
- Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
- How do I use “if field exists” with $curauth?
- Can’t save custom field on registration page
- Read more to open external link
- Custom metabox not displaying multiselect data in edit mode
- How to validate select field in post meta?
- check for duplicate user meta data before updating
- WP Cli – post add meta in xargs after wp post generate – add multiple fields
- Anyone know how to use ACF and show custom fields for logged in users only on a post? [closed]
- How to redirect to home page according to a specific page custom fields value and user name
- How to use pre_get_posts to alter posts_per_page of category pages, where ‘posts_per_page’ will be dynamic
- How to print the Custom fields values [closed]
- Custom metabox not working
- Selectively hiding or allowing thumbnails of featured images on front page
- wp_get_attachment_image_src() with advanced custom fields returning empty
- Woocommerce products search with custom fields
- Saving Custom Field that includes Quotation marks
- how to execute custom field for structured data?
- Saving custom form data
- register_form, custom field not submitted on first try
- Wrap group of wp query posts to parent div by date/year
- Echo out custom fields in comments
- Why WordPress takes time to make request to save post?
- Show comon custom field results?
- Filter query based on date in custom field
- Display Child Page with custom fields within Parent Page
- Convert all dates in field to Unix time, except those already in Unix time
- get_post_custom_values not working
- Show div based on custom meta value
- Assign class to Drop Down Selections in WooCommerce Products Custom Fields
- Show/Hide Featured Image or replace it with custom field [closed]
- Archive for custom fields?