Sorting: custom query with orderby meta_value_num THEN by title

This is very crude but should sort your posts by year (meta_value) and then by title. It does depend on how the query is setup so it will only work with the query below or with similar ones. function alter_order_wpse_103181($order,$qry) { remove_filter(‘posts_orderby’,’alter_order’,1,2); $order = explode(‘,’,$order); $order = implode( ‘ ASC,’,$order); return $order; } add_filter(‘posts_orderby’,’alter_order_wpse_103181′,1,2); $q … Read more

Custom Post Type Order Index Loop

You’re only referencing the event date in your query, which is why you’re not getting normal posts (because I assume they don’t have an event date). You can use “orderby” with multiple values (separated by a space), so you should be able to change it to: ‘orderby’ => ‘meta_value date’ That should mean that the … Read more

Apply ordering args to newly merged queried

Here’s what I’d do. This is mildly tested. It gets the IDs of all the posts you need and then builds a single query to get the posts in the correct order. // get your page IDs, I assume this returns an array of integers $page_ids = get_pageslug(” ‘first_page’, ‘second_page’ “); // get your blog … Read more

$args Orderby The number

You could use the get_terms_orderby filter: add_filter( ‘get_terms_orderby’, ‘wpse156153_get_terms_orderby’, 10, 3 ); $categories=get_categories($cat_args); remove_filter( ‘get_terms_orderby’, ‘wpse156153_get_terms_orderby’, 10, 3 ); with function wpse156153_get_terms_orderby($orderby, $args, $taxonomies ) { return ‘FIELD(t.term_id, ‘ . $args[‘include’] . ‘)’; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)