Revolution Slider Orderby Two Custom Fields

To order by event-end date or start date, your write separate function and call them as per requirement. For example if user clicks on order by start then start function should be called. switch($orderby){ case: ‘event-start’: # your code /* $query[‘meta_key’] = ‘event_start_date’; $query[‘orderby’] = ‘event_start_date’; */ break; case ‘event-end’: #your code /* $query[‘meta_key’] = … Read more

WooCommerce – Customer Order History Pagination

I have added pagination in order history page and it is working. Replace below code above loop $my_orders_columns = apply_filters( ‘woocommerce_my_account_my_orders_columns’, array( ‘order-number’ => __( ‘ID’, ‘woocommerce’ ), ‘order-date’ => __( ‘Date’, ‘woocommerce’ ), ‘order-total’ => __( ‘Packages’, ‘woocommerce’ ), ‘order-total’ => __( ‘Price’, ‘woocommerce’ ), ‘order-status’ => __( ‘Status’, ‘woocommerce’ ), ‘order-actions’ => ‘ ’, … Read more

Order Posts by Alphabetical for Each Letter

This is what I find for this question. Two codes I found were coded by MichaelH from wordpress.org. Even he won’t probably see this post, I want to thank him. Now, I just need to sort these posts from specified one category. If anyone knows how to sort them with specified category, please help me. … Read more

How to order a post type with meta_value_num and if meta_value_num does not exist then order by date

You can pass a space-delimited set of columns to orderby argument of WP Query: $args = array( ‘meta_key’ => ‘wp_ratings’, ‘orderby’ => ‘meta_value_num date’ ); $query = new WP_Query( $args ); You can also pass an array of key => sort_order for more granular control, for example: $args = array( ‘meta_key’ => ‘wp_ratings’, ‘orderby’ => … Read more

query_posts doesn’t order by title

Thanks to Chip Bennett who told me that i’m doing wrong by using query_posts inside content. So i used get_posts and i got what i wanted, thanks! Here is sample of how can you do it, if you got the same problem as me: function some_name(){ global $post; $tmp_post = $post; $args = array( ‘post_type’=>’page’, … Read more

WordPress Ordering Problem. How to fix ordering 1-10-100 issue?

Based on the research I’ve done on this, using term meta data is a better all around approach to ordering terms. However, I was able come up with this snippet which does sort the terms by their name, numerically: add_filter( ‘terms_clauses’, ‘wpse247680_terms_clauses’, 10, 3 ); function wpse247680_terms_clauses( $pieces, $taxonomies, $args ) { // Bail if … Read more

Order posts by date and then by custom field

add_filter(‘posts_orderby’, ‘posts_orderby’); function posts_orderby($orderby_for_query) { global $wpdb; $prefix = $wpdb->prefix; $orderby_for_query = “LEFT(” . $prefix . “posts.post_date, 10) DESC, ” . $orderby_for_query; return $orderby_for_query; } This produces this query: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish”) AND (wp_postmeta.meta_key = ‘my_post_rating’ ) GROUP BY wp_posts.ID ORDER … Read more

Order get_users() by last login date. Is it possible?

First, you need to store the actual login date, because this is not stored by default. You can use this code to do that(use it in your functions.php) add_action(‘wp_login’,’user_last_login’, 0, 2); function user_last_login($login, $user) { $user = get_user_by(‘login’,$login); $now = time(); update_usermeta( $user->ID, ‘user_last_login’, $now ); } After that, you can use the meta field … Read more

the_tags() : display the tags by the order they are typed in in the backend, not alphabetically

Follow the White Rabbit: the_tags() get_the_tag_list() get_the_term_list() get_the_terms() wp_get_object_terms() If you look through that last function, you should see this: $defaults = array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘fields’ => ‘all’); You should have alphabetical order by default. And no, there are no filters I see that would allow you to directly alter the query, … Read more

WP_query ‘orderby=none’ Problem

You can order them manually after the query is complete: $ids = array (60, 23, 78, 46, 105, 130) $args = array ( ‘posts_per_page’ => -1, ‘post__in’ => $ids, ‘orderby’ => ‘none’ ); $query = new WP_Query ( $args ); $ordered_posts = array(); foreach($ids as $rpid) foreach($query->posts as $index => $fpid) if($fpid->ID === $rpid) $ordered_posts[] … Read more

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