WP Query and multiple pages

Because your posts are only saved whithin the $promo var and not in the $wp_query global var. I recommend you to use get_posts() http://codex.wordpress.org/Template_Tags/get_posts

WP Query get only 1 post (sticky, not sticky etc)

Why don’t you use a fat-free $wpdb->get_var() for the task? global $wpdb; $ID = $wpdb->get_var(“SELECT `ID` FROM {$wpdb->posts} WHERE `post_type`=’post’ AND `post_status`=’publish’ ORDER BY `post_date_gmt` DESC LIMIT 1;”); $post = $ID ? get_post($ID) : null; // Now get the actual post This is way more efficient and light-weight. Without all the bells and whistles of … Read more

Post order by custom fields

That would be something like: query_posts( array( ‘cat’ => ’16’, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘time’, ) ); See WP_Query documentation in Codex for more information.

$post in wp_query?

$query = new WP_Query( $args ); while( $query->have_posts() ) { // this fills in the $post global with the next post from the query $query->the_post(); // we’re now ina classic wordpress loop, and can use all the usual stuff the_title(); the_content(); echo $post->post_content; } // lets clean up after ourself so else we might mess … Read more

Multiple loops breaking side bar

Since the sidebar was being deployed while inside the loop, the if ( have_posts() ) : was what was causing it to break. Here’s the fix: <div id=”FL-pest-libray-sidebar”> <?php $category_query_string = new WP_Query(array( ‘post_type’ => ‘page’ , ‘posts_per_page’ => ‘-1’ , ‘post_parent’ => ‘413’)); while ( $category_query_string->have_posts() ) : $category_query_string->the_post(); ?> <div <?php $catspacetitle = … Read more