Advertisement
raselahmed7

Post Query Example

Sep 5th, 2013
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  1. <?php
  2. global $post;
  3. $args = array( 'posts_per_page' => 10, 'post_type'=> 'post' );
  4. $myposts = get_posts( $args );
  5. foreach( $myposts as $post ) : setup_postdata($post); ?>
  6.     <h2><?php the_title(); ?></h2>
  7.     <?php the_content(); ?>
  8. <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement