• I have been using the featured post code from the WordPress codex for a while, but now I want to have 3 featured posts on my blog. Here is the code I’m currently using: (from the codex)

    <?php $my_query = new WP_Query(‘category_name=featured&showposts=1’);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>

    [Where I want to put the 3 featured posts]

    <?php endwhile; ?>

    Do other stuff here

    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    Where I want the rest of the featured posts, but ignore the first 3 featured posts that are presented at the top of the page
    <?php endwhile; endif; ?>

    I guess the obvious answer is that I need to store the 3 posts IDs in an array, but how do I do that?

  • The topic ‘3 featured posts’ is closed to new replies.