Support » Fixing WordPress » show number of posts from category

  • i am usign this code

    <ul class="list-1">
    									 <?php
    									 global $post;
    									 $myposts = get_posts('posts_per_page=10&category=9');
    									 foreach($myposts as $post) :
    									   setup_postdata($post);
    									 ?>
                                          <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></li>
    									  <?php endforeach; ?>
                                        </ul>

    but it only returns 5 posts and not 10..

    Can someone help me ?

Viewing 1 replies (of 1 total)
  • ok.. found it – writing it for other’s

    <ul class="list-1">
    									<?php $recent = new WP_Query("cat=9&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
    									<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
    									<?php endwhile; ?>
                                        </ul>
Viewing 1 replies (of 1 total)
  • The topic ‘show number of posts from category’ is closed to new replies.