Last active
December 14, 2015 11:59
-
-
Save miukimiu/5082877 to your computer and use it in GitHub Desktop.
Um exemplo de como ter um destaque apenas na primeira página.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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