Support » Developing with WordPress » Custom loop including sticky post

  • I’m trying to implement sticky posts into this custom loop. I’ve tried a lot of different solutions and came really close one time, but it didn’t work properly. So…

    What I want is to display the posts, one of them a sticky post as the first post.

    This is what I have. Is it even possible? Maybe two loops? But how then?

    <ul class="home-recent-list">
    <?php
    	$recent_posts = wp_get_recent_posts(array(
    		'numberposts' => 3, // Number of recent posts thumbnails to display
    		'post_status' => 'publish' // Show only the published posts
    	));
    	foreach( $recent_posts as $post ) : ?>
    		<li>
    			<h6><?php echo $post['post_title'] ?></h6>
    			<?php echo wpautop($post['post_content']); ?>
    		</li>
    	<?php endforeach; wp_reset_query(); ?>
    </ul>

    Would appreciate any suggestions.
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom loop including sticky post’ is closed to new replies.