You need to use the meta_key
to sort your events in your array. Like so:
<?php $loop = new WP_Query( array( 'post_type' => 'kurs', 'meta_key' => 'dato', 'order_by' => 'meta_value', 'order' => 'ASC' ) ); ?>
Related Posts:
- Sort custom post type by most current date picker
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- Make custom column sortable
- How to set a custom post type to have viewable future posts
- group search results by post type?
- register_post_type sort order by title by default
- Drag n Drop Post Order for multiple Custom Post Types
- Sort custom post type list table by display name of a user id stored as post meta value
- Custom sortable columns ordered by meta-value?
- How to order adjacent posts (prev / next) by custom field value?
- WordPress post sorting with AJAX
- Ordering posts by custom taxonomy in admin area
- Custom Post Type, WP_Query and ‘orderby’
- Sorting a query by custom field date
- Custom Taxonomy Template Post List with Sort Order
- Ordering Posts List By Taxonomy Terms?
- Column sorting with emtpy meta values
- Number of pages – multiple (custom) post types
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- how to sort post in admin column by recently
- Custom Post type sort order not working in the admin area
- How to sort a table of custom posts by column containing custom field
- How to Sort Custom Field Admin Column by Date
- Sort Posts Best Practice
- Custom Post Type sorted by Title
- Sort by two dates. Default entry date and custom field if present
- How do I sort a custom post type admin column using two meta keys?
- Custom-post-type-archive: posts sorted/filtered by year?
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- Custom Post Type Events Archive Grouped By Month
- Sort admin area by custom Event Date field
- Custom post type ‘orderby’ => ‘meta_value’ not working
- How to rank custom post type from score points
- Sorting multiple custom post types without a meta key/value pair by sort order
- Combining sorted and random CPT
- Default sort on admin columns with meta date hides draft posts with empty date value
- Categories sorting
- Wp_query: sort by PHP variable
- Crafting WP_Query array, sort by date
- Display upcoming Events for next 7 Days
- CPT EVENT – listing by month and filtering by category and month – form select option
- Custom post type, organized by categories
- WooCommerce sort products by the actual product width(not the shipping width)
- Sort and filter custom post type posts by custom taxonomy
- WordPress posts page for customer filtering and sorting along with category filter
- manage_edit-{post_type}_sortable_columns sorts, but wrong!
- Creating a Custom Post Type and Joining with Users
- Select event where start date is smaller than current date and end date is greater than current date
- sort post types by amount of views
- List of all entries of custom-post-type: Add year-parameter?
- Custom Post Type page sorts differently on different environments
- Should i use a plugin for Event Manager or code my own needs? [closed]
- Creating a “glossary” of WordPress posts of a specific post type
- Sort results without WP_QUERY?
- Make a custom column sortable by a value from a different custom post type
- the ‘save_post’ event triggers when I want to start a new post
- sort by name (slug) custom post type
- Sort column on meta key and meta value
- Sorting custom post types in edit.php : Post disappear
- Empty meta-box returns publishdate if no value is set?
- Event Archive by Month
- Custom loop request based on custom field
- how to compare different timestamps in wp-query for events custom post types?
- Creating an Events Feed with Sub Pages/Posts for Each Event
- Yelp-style geographic directory plugin?
- What’s an easy way of sorting custom post types manually?
- How can I sort the order of multiple custom field values in a custom post type?
- How do I list the next 7 days and any events (cpt) contained in those days
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- Sorting the Loop by Taxonomy Value
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- Sort custom posts by date and then by taxonomy
- Custom post type sortable columns when column value is from a custom database value
- Sort custom post type by custom datepicker instead of filtering
- Custom post type order by post_title
- How to sort post category using its Description
- How to use multiple orderby conditions on query search results? (orderby one post type, relevance)
- Wp Query sort order from custom MetaBox
- sorting in wp query based on custom field value
- week days sorting based on starting day
- connect users to Custom post types
- How to sort custom post’s category by id from the theme’s function.php?
- Group/list/sort custom post type posts by date in tabs from acf datepicker field
- Query events post type after current date and timezone
- Grouping and paging CPT events by month with custom field date
- Ordering Posts List By Taxonomy Terms?
- Loop posts in a table ordered by a custom field value
- Custom Loop Event Page
- Events with multiple event dates + permalink for each date
- Query Event Posts by Date
- How do I sort post listing by child post count?
- Make custom post type column sortable
- How can I sort posts ascending by post title for a specific post type, but on a category archive template?
- Unable to sort wp_query by date/time with multiple meta_key s
- Test if a Category contains certain Custom Post Types
- Sort CPT by taxonomy AND THEN by custom field
- Custom order of CPT posts by title, in wp-admin area by default
- Sorting by Title for Post Archive Categories for Custom Post Type
- What would be the optimal CPT / Taxonomy design for the following entities structure