Last active
April 7, 2018 01:15
-
-
Save hawkidoki/218f93e54209cb9654d3f35dc5041c93 to your computer and use it in GitHub Desktop.
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 | |
// On vérifie que notre Template est bien appelé via hwk_loop() | |
// $loop a accès à toutes les arguments de hwk_loop() | |
if(!$loop = get_query_var('hwk_loop')) | |
return; | |
?> | |
<!-- Traitement de la boucle --> | |
<!-- Les résultats sont stockés dans $loop['result'] --> | |
<?php if($loop['result']->have_posts()): ?> | |
<?php while($loop['result']->have_posts()): $loop['result']->the_post(); ?> | |
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</div> | |
<?php endwhile; wp_reset_postdata(); ?> | |
<!-- Si 'pagination' = true, alors gérer la pagination --> | |
<?php if($loop['pagination']){ ?> | |
<?php | |
echo paginate_links(array( | |
'current' => max(1, get_query_var('paged')), | |
'total' => $loop['result']->max_num_pages | |
)); | |
?> | |
<?php } ?> | |
<!-- Pas de résultats --> | |
<?php else: ?> | |
<div> | |
Aucun résultat. | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment