Skip to content

Instantly share code, notes, and snippets.

@miukimiu
Last active December 14, 2015 11:59
Show Gist options
  • Save miukimiu/5082877 to your computer and use it in GitHub Desktop.
Save miukimiu/5082877 to your computer and use it in GitHub Desktop.
Um exemplo de como ter um destaque apenas na primeira página.
<?php
$counter = 1;
$max = 1;
// The Loop
while ( have_posts() ) : the_post();
//queremos apenas um artigo de destaque. Logo limitamos o loop para apenas o último artigo.
if ($counter == $max) {
?>
**************** Aqui fica o destaque **************
<?php
}
$counter++;
endwhile;
// Reset Query
wp_reset_query();
?>
<?php
$counter = 1;
// The Loop
while ( have_posts() ) : the_post();
//começa a contar a partir do primeiro artigo pois o primeiro já foi impresso em cima.
if($counter>1 || $paged>1)
{
?>
***************** Aqui aparecem os artigos *****************
<?php
} // endif
$counter++;
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment