• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter betawaffles

    (@betawaffles)

    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(); ?>

    Thread Starter betawaffles

    (@betawaffles)

    Oops ignore that last </div> and <?php get_footer(); ?>.

    Thread Starter betawaffles

    (@betawaffles)

    The post title will not appear right actually, it displays the most recent post title in general.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Want posts in category on main page but not with the rest.’ is closed to new replies.