Skip to content

Instantly share code, notes, and snippets.

@babelpuntocl
Created April 22, 2014 14:20
Show Gist options
  • Save babelpuntocl/11181057 to your computer and use it in GitHub Desktop.
Save babelpuntocl/11181057 to your computer and use it in GitHub Desktop.
Dos loops con sticky Post
// Primer loop
<?php $sticky = get_option('sticky_posts'); rsort( $sticky ); $sticky = array_slice( $sticky, 0, 5); query_posts( array( 'post__in' => $sticky,'caller_get_posts' => 1 ) ); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
//contenido
<?php endwhile; endif; wp_reset_query(); ?>
// Segundo loop
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $no_sticky_args = array('post__not_in' => get_option('sticky_posts'), 'paged' => $paged ); query_posts($no_sticky_args); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
//contenido
<?php endwhile; endif; wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment