So, now I’ve decided to sort in php:
function compare_collections( $c1, $c2 ) {
if( $c1->menu_order == $c2->menu_order ) {
return ( $c1->post_title < $c2->post_title ) ? -1 : 1;
} else {
return ( $c1->menu_order < $c2->menu_order ) ? -1 : 1;
}
}
// and then in my template:
uasort( $colls->posts, 'compare_collections' ) ;
But I would be glad to understand what’s wrong 🙂
My guess is that p2p_type( )->get_connected
‘s sorting preferences are stronger or like that. Excuse me, I am not a programmer 🙂
Related Posts:
- Custom Post Type order by modified date and custom meta field issue
- Changing WordPress sort order for returned child pages
- Custom post type order by post_title
- Show first posts with custom field not empty and order all by title
- Help ordering custom query by Title, Ascending
- Allow admin to determine the order of queries?
- Order custom post type is beign ignored
- Order by custom field meta_key date and then by custom file meta_key number
- Custom post type posts don’t show in archive widget
- Showing specific post in order of array wp_query
- Archive not sorting correctly
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- Ascending Order is not Working in Custom Post Type Listining
- Add a custom meta box for client to order CPT posts how they want
- Number of posts in the archive
- Query of custom post types only shows first post
- Custom query for custom post_type
- Adding custom field values to wp_list_pages
- Query multiple taxonomies with pre get posts
- How to query 2 custom post types that need to share a slug?
- Custom post type sorting: alphabetical order
- Query Custom Post Types with checkboxes
- WP_Query() with custom post type and taxonomy — get all terms?
- show all custom posts types in home page
- List of child custom post types lists all custom post types
- $wpdb->get_col and ORDER BY?
- Query custom post type based on post id and custom field value
- Listing custom post types on archive page with array
- Make (custom) post type accessible only by custom query
- Can I query posts by taxonomy conditionally based on post type?
- How to conditionally add Custom Post Type to Front Page
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Graphql: Unable to query (where:{author}) for custom post type
- WP_Query of custom post type sorted by meta_key has unexpected results
- Query not work for current taxonomy
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Returning a custom content types with meta values
- WP_Query not resetting after wp_reset_postdata
- Custom Query: If One Post Object Field Value Is The Same As Another
- Break up posts per page in two sections
- Custom Post Type not showing in main loop
- Custom Post Type setup
- new WP_query > displays posts only once instead of running through full array
- Pagination on search results page
- Querying a custom post type, but not show duplicates
- Shortcode to return single custom post based on post taxonomy
- is_main_query() never called on WP 4.4
- Hide text if query has no posts
- How do I get the index for a custom post?
- Getting custom post types to properly display alphabetically
- Create query for both custom post type and category
- Filtering custom posts by custom fields (ACF) [closed]
- Post ordering not working with custom field
- Function to limit number of custom post types on homepage – TwentyTen
- Filtered by a custom field, ordered by another
- orderby parameter not working in custom query
- Custom taxonomy query showing more than 4 posts
- Custom types, taxonomies and query optimization
- Adding Page Ordering to a Custom Page Type
- Query Custom Post by taxonomy multiple categories
- Query custom posts from custom taxonomy
- Custom Post type showing up in loop, regular posts are not showing up
- All in one calendar custom post type query doesnt work as expected
- Displaying Portfolio Filter by Category Order (alphabetically)
- Adding a Custom Field to be used by Posts 2 Posts
- show most viewed posts of last days by link?
- Posts 2 Posts plugin: best way to change connection field value?
- Add custom post type to query
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- How to divide Subcategories into pages of parent category wordpress
- Order posts by taxonomy terms
- Update query based on CPT / Post Type, show all sorted by date
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- wp rest api orderby field in a custom table
- WP Query from two Custom Post type fields as statement
- WP Query: If field X is empty, show posts based on field Y
- Display Parent-Child Posts in specific order by comparing IDs in array
- Check that a slug is present in the get_terms request
- Using OR relation in meta_query to check for a value before sorting by another
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- How can I sort the results of a REST API response by the title of a connected custom post type?
- Does this archive template part look like its making too many calls to the db?
- Shortcode with loop stacks output
- Displaying all posts by category and showing content on click
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- How to order taxonomy terms by most recent post?
- Meta query and compare “!=” not working as expected
- Orderby if between two meta fields
- Creating a custom WP query for a Custom Post Type
- Display custom posts, ordered by most commented, without duplicates
- How select query is generated in a Custom Post Type?
- SEARCH QUERIES – REVERSE OUTPUT
- order custom post type posts by custom date
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How do I query with multiple custom fields orderby in same column?
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- How to order multiple custom post types with same taxonomy by date
- Wp Query sort order from custom MetaBox