Configure query with multiple categories in a custom order?

I am hoping that I understood your question, because recently I found myself needed to dynamically include a list of child categories and their count in a hierarchy menu in a post and so I came up with this: I put this in file called listcat.php <?php /* Plugin Name: List Categories Reference: http://codex.wordpress.org/Template_Tags/wp_list_categories Description: … Read more

Query All Attachments and Order by Parent Publish Date

After spending some time reading the documentation for WP_Query’s Order & Orderby Parameters I found the following listed parameter to almost get me there: ‘post__in’ – Preserve post ID order given in the post__in array (available since Version 3.5). Unfortunately I wasn’t using post__in but rather post_parent__in so ordering by post__in didn’t work. It wasn’t … Read more

Orderby modified only for specific post types

Am Afraid that you have to go with Direct MYSQL or you can run two WP_Query() and then combine them, sort them or sort them with WP_Query() then combine them. Here is an example $args = array( ‘post_type’ => array( ‘staff-updates’, ‘coreteam’, ‘developing-updates’, ‘vacancies’, ‘recognition’, ‘page’ ), ‘orderby’ => ‘modified’, ‘posts_per_page’ => ’10’, ‘order’ => … Read more

How to order custom user list columns by datetime?

I think you could simplify this a lot by using the pre_get_users hook, instead of working directly with the complicated SQL within the pre_user_query hook. Try something like: add_action( ‘pre_get_users’, function( \WP_User_Query $q ) { $qv = &$q->query_vars; if( isset( $qv[‘orderby’] ) && ‘test_date’ === $qv[‘orderby’] ) { // Custom meta query $qv[‘meta_query’] = [ … Read more

Get query result according to merged array

Use orderby post__in $loop = new WP_Query( array( ‘post_type’ => ‘product’, ‘post__in’ => $posts, ‘paged’ => $paged, ‘posts_per_page’ => 5, ‘orderby’ => ‘post__in’ ) ); Remember it is only available from version 3.5

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