• I made a sticky post in one of my categories and it shows up on the top of my main page as one would expect.
    Is there a way to make a sticky post for the respective category it was posted in?

    TIA!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not easily. The sticky option only works, out of the box, on the front page of the site. In theory, it’s possible to stick the post to the top if its category page (though I’ve not tried that myself – yet) but it would need some additional custom code added to the catgeory template file.

    Thread Starter rforster

    (@rforster)

    I fought with the loop thing for a while trying to make a custom template so could make a page and then have posts below it. Kinda like a FAQ for that category and then descending posts.

    Maybe I can make the stickies work in each category but NOT on the front page… That would be better.

    Thx for responding.

    What about using:

    <?php
    $sticky_posts = get_posts(array('post__in'=>get_option('sticky_posts')));
    if($sticky_posts):?>
    <ul>
    <?php foreach ($sticky_posts as $sticky) {
    	echo '<li><a href="'.get_permalink($sticky->ID).'">'.$sticky->post_title."</a></li>\n";
    }
    ?>
    </ul>
    <?php endif;?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sticky posts only in category?’ is closed to new replies.