Outputting more posts than I want it to
-
Check out EntertainmentCocktail.com/movies for the page that’s bothering me.
As you can probably see, I’m trying to have a list of “Recent Film News” on the left underneath the recent reviews box. I’ve managed to include exclusively movie-category news, but for some reason it wont limit it to just 8 articles.
My code for that section:
<ul class="list2"> <?php global $latestnews; $args = array( 'numberposts' => 5, 'category' => 3, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish' ); $latestnews = get_posts($args); ?> <?php foreach ($latestnews as $post) : setup_postdata($post); { ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php } endforeach; ?> </ul>
As you can see, I’ve made sure to use the numberposts tag in the array (set to 5 so I can clearly see a difference when it’s working!) but on the website it’s showing all 9 (current) articles.
What’s going wrong?!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Outputting more posts than I want it to’ is closed to new replies.