Return to Snippet

Revision: 40583
at February 4, 2011 02:48 by amyb


Initial Code
<?php
$args = array( 'numberposts' => 3, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => 7 );

$postslist = get_posts( $args );
		
foreach ($postslist as $post) :  setup_postdata($post); 
?> 

<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                  
<?php the_excerpt(); ?>
                 
	
<?php endforeach; ?>

Initial URL

                                

Initial Description
Modify the array to  get different number of posts, change the order, change / add categories etc.

Initial Title
Wordpress - get posts for a category

Initial Tags
wordpress

Initial Language
PHP