I am having this issue with my loops. I am making a shortcode that will be called from the main query. It will display on the front page from the_loop. for some reason that I can't figure out. The second query displays only one post when it should display 3. So the shortcode will go in the page content. In the settings section, I have the front page set as static to "Home" and the blog page set to "Blog" but home is not a template. It is being generated by the index.php page using WordPress 2014 theme. So in the "Home" page content area, I have the shortcode that generates the second loop to get 3 posts from a category called "featured".
$featured = new WP_Query( array( 'category_name' => $category, 'posts_per_page' => 3 ) ); if( $featured->have_posts()) : while( $featured->have_posts()): $featured->the_post(); global $more; $more = 0; the_title(); the_content( '<a class="clear" href="'.get_permalink().'"><img class="button" src="'. get_template_directory_uri() .'/images/read-more.png" alt="read more" height="32" width="85" /></a>' ); endwhile; endif; wp_reset_postdata();
This loop will display the first of the three posts but not the other two.
I also tried using get_posts but that didn't work out any better