/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $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.