Return to Snippet

Revision: 38762
at January 7, 2011 03:34 by dloop


Updated Code
<?php
$args = array( 'posts_per_page' => 10, 'order'=> 'ASC', 'orderby' => 'title' );
$postslist = get_posts( $args );
foreach ($postslist as $post) :  setup_postdata($post); ?> 
	<div>
		<?php the_time(); ?>
		<?php the_title(); ?>   
		<?php the_excerpt(); ?>
                <?php the_category(', '); ?>
	</div>
<?php endforeach; ?>



Notice the div around the_time, the_title, the_excerpt and the_category. You can wrap html elements to fit and style any of these functions.

the_time will display the time of the post. use the_time instead of the_date.
http://codex.wordpress.org/Formatting_Date_and_Time

the_title will display the post title.

the_excerpt will display the post excerpt which defaults to 55 characters unless specified by a filter in functions.php. currently the twenty-ten theme sets the excerpt character limit.

the_category will display which categories the post is in, if any.

Revision: 38761
at January 7, 2011 03:32 by dloop


Initial Code
<?php
$args = array( 'posts_per_page' => 10, 'order'=> 'ASC', 'orderby' => 'title' );
$postslist = get_posts( $args );
foreach ($postslist as $post) :  setup_postdata($post); ?> 
	<div>
		<?php the_time(); ?>
		<?php the_title(); ?>   
		<?php the_excerpt(); ?>
                <?php the_category(', '); ?>
	</div>
<?php endforeach; ?>

Initial URL


Initial Description


Initial Title
Wordpress: Display Latest Blog Posts on Any Wordpress Page

Initial Tags


Initial Language
PHP