Skip to content

Instantly share code, notes, and snippets.

@fernandofuly
Created July 24, 2014 14:37
Show Gist options
  • Save fernandofuly/ebcc5be9d212756854e8 to your computer and use it in GitHub Desktop.
Save fernandofuly/ebcc5be9d212756854e8 to your computer and use it in GitHub Desktop.
Two Different Sticky Loops - WordPress
<?php $do_not_duplicate = array();
$my_query = new WP_Query(
array(
'posts_per_page' => 3,
'post__in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true
)
);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID;
?>
// Conteúdo do Post
<?php the_title(); ?>
<?php break; endwhile; ?>
<?php
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID;
?>
// Conteúdo do Post
<?php the_title(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment