• Hello everyone! First of all sorry me for my bad English but isn’t my native language so I’ll do as best as possible to explain my problem.

    I’ve a site running the last version of WordPress (4.6.1) and I want to display the sticky posts at the top of post loop on index.php. My theme’s code is the following:

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; $c=0; ?>
    <?php
    if( is_home() && !is_paged() ) :
    global $query_string;
    query_posts( $query_string . '&cat=1,2&posts_per_page=7' );
    endif;
    ?>
    <?php /* Start the Loop */ ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $c++;
    if( !$paged && $c == 1 ) :?>
    FIRST POST STYLE
    
    <?php else :?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endif;?>
    <?php endwhile; ?>

    Is there any piece of code I’m missing? Thanks in advance! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Include sticky posts on index’ is closed to new replies.