How do I show sticky posts on a static front page that also contains content?

Something like this should work:

$sticky = get_option( 'sticky_posts' );
if ( !empty( $sticky ) ) {  // don't show anything if there are no sticky posts
    $args = array(
        'posts_per_page' => -1,  // show all sticky posts
        'post__in'  => $sticky,
        'ignore_sticky_posts' => 1
    );
    $query = new WP_Query( $args );
    if ( $query->have_posts() ) {
        $query->the_post();
        // display your sticky post here (however you like to do it)
    }
}

You should place this in your front-page.php file. It will select all sticky posts and show them.

Leave a Comment