I am trying to get posts in a category to appear on the main page but in a div on its own, not with the rest of the posts. Any idea on how to accomplish this, Either using php or a plugin? The category number is 3.
I am trying to get posts in a category to appear on the main page but in a div on its own, not with the rest of the posts. Any idea on how to accomplish this, Either using php or a plugin? The category number is 3.
To answer my own post, this does the trick:
<?php $posts = get_posts( "category=6&numberposts=10" ); ?>
<?php if( $posts ) : ?>
<div class="post" id="post-<?php the_ID(); ?>">
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<?php echo wptexturize($post->post_content); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Oops ignore that last </div> and <?php get_footer(); ?>.
The post title will not appear right actually, it displays the most recent post title in general.
This topic has been closed to new replies.