posts_nav_link pulling in multiple post types

query_posts should be avoided at all costs. This is not just my emphasis, but the codex’s as well Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query … Read more

Custom wp_query – I’m getting ‘all’ post, not the specific post in the query

You should use tax_query for that. See official documentation here. Try this: $indicaArgs = array( ‘post_type’ => ‘product’, ‘productType’ => ‘Indica’, ‘locationCity’ => ‘Los Angeles’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘productType’, ‘field’ => ‘slug’, ‘terms’ => ‘indica’, // here should be slug ), array( ‘taxonomy’ … Read more

Wp_query…a type of term a different div

The easiest way is to just create conditional statements checking for the term and wrapping it in a div of your choice. After you loop starts you could do something like: while ($list_query->have_posts()) : $list_query->the_post(); if( has_term( ‘casegoods’, ‘tag-series’ ) ) { echo ‘<div class=”left-side”>’; the_content(); echo ‘</div>’; } elseif ( has_term( ‘casegoods’, ‘rugs’ ) … Read more

Sorting by meta_key different to search criteria?

The value for the value key in the meta query is probably the cause of the problem. ‘value’ => get_post_meta( get_the_ID(), ‘cancelled’, true ) The get_post_meta call actually retrieves the value of the meta key “cancelled” for the current post. So, in your current WP_Query, you’re retrieving all posts with a paypal_recur_profile_status equal to the … Read more

Echo the number of posts being displayed

rearrange your code and use post_count; example: <?php $movieNumber = 1; $today = date(‘Ymd’); $posts = array ( ‘post_type’ => ‘movie’, ‘posts_per_page’ => -1, ); $loop = new WP_Query( $posts ); ?> <div id=”posters<?php echo $loop->post_count; ?>”> <?php while ( $loop->have_posts() ) : $loop->the_post(); …etc…

Issue with data array format

Your code looks good though. But Try the following approach – $current_date = $_POST[‘current_date’]; $current_date = date( ‘Y-m-d’, strtotime($current_date) ); $post_id = (int) $_POST[‘post_id’]; $query = $wpdb->prepare( “SELECT start_date FROM {$wpdb->prefix}booking_history WHERE start_date=%s AND post_id=%d”, $current_date, $post_id ); /* get_col used to retrieve column records */ $results = $wpdb->get_col( $query ); echo ‘<pre>’; print_r( $results … Read more