post re-order on my site
There is a plugin called Post Types Order which allow you to sort posts and pages you should try that.
There is a plugin called Post Types Order which allow you to sort posts and pages you should try that.
Zlatev meta_key is the name of the custom post type, and is a VARCHAR(255) meta_value is the value of the key, and is a longtext With your query you are not ordering by values, but by the name of the field. The query works for _thumbnail_id because you are using LEFT JOIN and the CPT … Read more
The actual slug for the WooCommerce menu item is ‘woocommerce’. So if you replace: ‘edit.php?post_type=shop_order’, // WooCommerce with: ‘woocommerce’, // WooCommerce the above code will work. I found a handy function that will display all the items in the menu array at How to remove admin menu pages inserted by plugins?. Here is the function … Read more
As of WordPress 4.2, you can combine meta_query and orderby. The following example is taken from make.wordpress.org. Example of a simple meta_query: $q = new WP_Query( array( ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘state_clause’ => array( ‘key’ => ‘state’, ‘value’ => ‘Wisconsin’, ), ‘city_clause’ => array( ‘key’ => ‘city’, ‘compare’ => ‘EXISTS’, ), ), ‘orderby’ … Read more
Random ordering is quite expensive operations in SQL and can become a headache on very big sites. Getting a random post from a category for 6 categories will mean you might need to run 6 separate queries, each ordered randomly. This can really break the bank and leave you bankrupt. From your answer and looking … Read more
First, I would solve your problem using WPQuery. Best to go there as opposed to query_posts Second, once you acknowledge and accept that WP Query is your friend for as long as you are within the wonderful world of WP theming, then you have to do as follows to solve your particular pickle: if(is_category(‘your_category’) : … Read more
Try adding ‘suppress_filters’ => true to your query args. Maybe you have a plugin that modifies the queries. You could also check if the posts out of order (the first one) is a sticky post. Sticky posts by default skip the order queue. You can disable this by adding ‘ignore_sticky_posts’ => true to your query … Read more
The order notes are saved as post comments, so you can use the WordPress function get_comments() to get the last note: $args = array( ‘post_id’ => $order_id, ‘orderby’ => ‘comment_ID’, ‘order’ => ‘DESC’, ‘approve’ => ‘approve’, ‘type’ => ‘order_note’, ‘number’ => 1 ); remove_filter( ‘comments_clauses’, array( ‘WC_Comments’, ‘exclude_order_comments’ ), 10, 1 ); $notes = get_comments( … Read more
Here’s my approach… First you have to select 3 latest posts, then you have to pick random one of them… But it’s easier to shuffle selected posts than picking only one of them – that way you can still use normal loop: <?php $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3, ‘post_status’ => ‘publish’ … Read more
The nav_menu_items are already sorted by menu_order. When you go into the Appearance -> Menus and arrange the order menu the menu_order of each menu item gets updated. To change the orderby parameter in the query that displays the menu you can use pre_get_posts to alter it. Example: add_action( ‘pre_get_posts’, ‘wpse_sort_nav’ ); function wpse_sort_nav( $query … Read more