Read more redirection problem
Read more redirection problem
Read more redirection problem
I guess meta_key is not a number, so you shouldn’t use %d in yous SQL query. $wpdb->prepare( “SELECT meta_value FROM %s WHERE user_id = %d AND meta_key = %s”,$userMeta,$user_id,$practiceKey ); // meta_key = %s not %d PS. You don’t have to escape table name in this way. You can use $wpdb->prepare( “SELECT meta_value FROM {$wpdb->usermeta} … Read more
Well, you still have to order the posts by your date key, but as far as output, the general idea is to store the current month in a variable and check it against the date of each post, and only output it when it changes. A pseudo-code example: $current_month=””; while( have_posts() ){ the_post(); $this_month = … Read more
You can do it with wp_query $args = array( ‘post_type’ => ‘post’, ‘numberposts’ => -1, ‘posts_per_page’=> -1, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘ratings_average’, ‘order’ => ‘DESC’, ); $posts = new WP_Query($args); Now the result is DESC Order.
to make this work all I did was add ‘terms’ => array(‘home’), to each term like this above ‘terms => ‘home’
You could split this into two WP_Querys: $args = array( ‘post_type’ => ‘match_report’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘report_type’, ‘meta_value’ => ‘cup’, ‘fields’ => ‘ids’ ); $reportsPre = new WP_Query($args); $post_IDs = array(); if(isset($reportsPre->posts) && !empty($reportsPre->posts)){ foreach((array) $reportsPre->posts as $id) { $post_IDs[] = $id; } } $args2 = array( ‘post__in’ => array($post_IDs), ‘meta_query’ => array( … Read more
Add: $first_attachment = reset($attachments); $first_attachment_id = $first_attachment->ID; $first_attachment_title = $first_attachment->post_title; Below: $nbImg = count($attachments); Now you are able to return the link with: echo wp_get_attachment_link( $first_attachment_id, ” , true, false, $first_attachment_title ); If you need a sort of custom link markup, you can have a look at the related functions: http://codex.wordpress.org/Function_Reference/wp_get_attachment_link Edit: There is no … Read more
note: Your code is not a loop, it’s a query to get a list of posts. In your template there should be a loop (using that list of posts) with a function to call the featured image. This is where you should change the template, and remove the call to the featured image. If you … Read more
WP_Query doesn’t have child_of argument. All you can do is to add post_parent argument, but it will work a little bit different – it selects only posts with parent set to given page. (It will return only direct children, and not grandchildren of given page/post).
I solved this by keeping my three separate queries and building a complex system to handle paging manually. It’s not ideal, but I really saw no better way to do it.