Sticky / featured posts (3 posts)

  1. Schackmatt
    Posted 4 years ago #

    Hi … noob hoping for help here. I've been struggling with this for a bit, and figured I'd throw in the towel and just ask.

    I'm trying to make a simple "featured posts" section using sticky posts. I found what seemed like a good tutorial (http://www.ilovecolors.com.ar/featured-posts-slider-wordpress/), which worked well enough (I dropped the second half as I'm not interested in the slider, I just want the posts).

    But … that the sticky posts remain on top of the page as well as in the featured posts section. How can I "unstick" the posts in the loop so they appear in their normal place? Code is below (I've updated the now deprecated 'caller_get_posts' from the original source to 'ignore_sticky_posts', btw):

    $loop = new WP_Query( array(
    'showposts' => 4,
    'post__in' => get_option('sticky_posts'),
    'ignore_sticky_posts' => 1 ) );
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php the_post_thumbnail( 'uthevet-image' ); ?>
    <h2>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
    <?php endwhile; ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    followed by the regular loop.

    Thanks in advance for any help.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You would need to ignore the sticky posts in your main Loop.

  3. Schackmatt
    Posted 4 years ago #

    Ah, that makes sense. I was only considering the sticky posts query, not the main loop itself (like I said, I'm a noob!). Thanks, I'll give it another shot. :)

Topic Closed

This topic has been closed to new replies.

About this Topic