Hi,
On a new site I am making, I want to take the last post in say category named "News" and place it aside from normal posts.
How might this be accomplished?
Thanks
Hi,
On a new site I am making, I want to take the last post in say category named "News" and place it aside from normal posts.
How might this be accomplished?
Thanks
Say category "News" has category id of 1.
<?php $posts = get_posts( "category=1&numberposts=3″ ); ?>
<?php if( $posts ) : ?>
<div class="section" id="latestNews">
<h2>Latest News</h2>
<ul>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li><span class="date"><?php the_time('F j'); ?></span> <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Ah thanks. I will try that out. :D
Last year I have asked a similar question and got a solution from Kafkaesqui:
http://wordpress.org/support/topic/28203?replies=11#post-193667
You can see it in action by clicking on my name here.
This topic has been closed to new replies.