How to sort custom post’s category by id from the theme’s function.php?

You need to change the orderby to ID: $args=array( ‘class’ => ‘select-submit2’, ‘hide_empty’ => false, ‘selected’ => $prop_category_selected, ‘name’ => ‘prop_category’, ‘id’ => ‘prop_category_submit’, ‘orderby’ => ‘ID’, //this changed to ID ‘order’ => ‘ASC’, ‘show_option_none’ => __(‘None’,’wpestate’), ‘taxonomy’ => ‘property_category’, ‘hierarchical’=> true ); wp_dropdown_categories( $args ); ?>

WordPress redundant posts based on meta field

I ended create another custom post type to manage the schedule and I created a relation to the existing films custom post type: – Films (all films without tv guide) – TV schedule (each post represents time in the tv guide and can only be related to one movie). I then enabled future posts to … Read more

Conditional email recipient based off Shipping Method [closed]

Firstly, get_shipping_method is a function. You seem to be using it as a variable. Secondly $order->get_shipping_method() returns Shipping method label, which you’re trying to compare with id. Now you can either compare Titles, or use $order->get_items( ‘shipping’ ); which returns an array with name, type, method_id, cost and taxes, and use method_id for comparison.

wp_query sorting – one specific meta_key value at last and then sort by create date

If you’re using WordPress 4.2 or newer then you can do the following: $args = array( ‘post_type’ => ‘products’, ‘posts_per_page’ => 10, ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘tools_clause’ => array( ‘key’ => ‘tools’, ‘compare’ => ‘EXISTS’, ), ‘create_date_clause’ => array( ‘key’ => ‘create_date’, ‘compare’ => ‘EXISTS’, ), ), ‘order_by’ => array( ‘create_date_clause’ => ‘ASC’, … Read more

Order & Orderby clause not working with custom query

Sorting your posts by relevance. The code below will output the posts ordered by relevance I have added some comments for some clarification let me know if it works. function my_custom_query(){ // get only the posts without order them $my_query_posts = new WP_Query( array( ‘numberposts’ => 5 ) ); // check relevance posts foreach( $my_query_posts->posts … Read more

ACF order relationship by date

The $journalEntries IDs are a post_type = post? Because if you don’t specify the post_type in the WP_Query it will default to ‘post’. So your $args array should be: $args = array( ‘post_type’ => ‘put_post_type_here’, ‘post__in’ => $journalEntries, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, );

Order comments in admin by custom date

I found the solution and happy to share the code: function cws_pre_get_comments( $comments ) { $comments->query_vars[‘meta_key’] = ‘datum_van_uitvoering’; $comments->query_vars[‘orderby’] = ‘meta_value_num’; $comments->query_vars[‘order’] = ‘DESC’; $comments->meta_query->parse_query_vars( $comments->query_vars ); } add_action( ‘pre_get_comments’, ‘cws_pre_get_comments’ );

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