Sort WordPress Posts Meta value by Week not Day

I agree with Rarst about the WEEK function, but be sure to also use YEAR as well to order the posts. So your order by would look something like this: ORDER BY YEAR($wpdb->posts.post_date) DESC, WEEK($wpdb->posts.post_date) DESC, $wpdb->postmeta.meta_value+0 DESC Of course, this is still pulling all posts, so you might also want to just limit the … Read more

Exclude current custom post on single post

Refer to the WP_Query Codex page for a full list and explanation of parameters. The one you want in this case is post__not_in. $recent = new WP_Query( array( ‘post_type’ => ‘works’ ‘posts_per_page’ => 5, ‘post__not_in’ => array( $currentID ) ) );

Problem when try to add ++1 for user meta

The problem here is twofold: the ++ operator is applied on an array. the user id and the meta key need to be swapped in get_user_meta() So use get_user_meta( $user_id, “_user_count”, true ); to get user meta. Note that the third input parameter is false by default and an array is returned. Setting it to … Read more

Odd / Even posts add class minus first post

You can do this in multiple ways, but you will need something commom to all posts, exemple: <div class=”post”></div> <div class=”post”></div> <div class=”post”></div> <div class=”post”></div> <div class=”post”></div> then in your css: .post:not(:first-child) { // add the rules of the class you wanted to add } Just select all elements except the first-child of posts with … Read more

Query returning same results even though the ID changes

You can pass your meta query into query_posts or (the preferable) WP_Query in 2 ways: An array using the array keys meta_key, meta_value, meta_type and meta_compare An array of arrays using the array keys key, value, type and compare In your question, you were trying to use a mix of the two, and that’s why … Read more

Search Query for Multiple Terms In Same Taxonomy

You need to make only one change in the form, change the first line to: <select name=”property_type[]” class=”form-control” multiple> Name of the field has to include [] to be considered as an array when it arrives on the server side. In the query string it will be listed as: property_type[]=condo&property_type[]=duplex And, on server side, when … Read more