
Originally Posted by
mgm_03
Building a custom theme. The home page is static although, I need to show the latest post (actually, just the first 300 chars) on the home page.
Need to pull from a particular post category (news).
I assume that I must use wp_query() with some parameters - instead of the default loop. Or, do I use conditional tags with the default Loop in some way.
Thanks
Fairly simple using the following code, adjust where needed:
PHP Code:
<?php
$args = array( 'numberposts' => 6, 'post_status'=>publish,'post_type'=>post,'orderby'=>post_date);
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="recentPosts">
<p><strong><?php the_date(); ?></strong></p>
<p><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p>
</div>
<?php endforeach; ?>
Bookmarks