• 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

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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; ?>

    Thread Starter evergreen

    (@evergreen)

    Ah thanks. I will try that out. 😀

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I get last post of specific category?’ is closed to new replies.