WP_Query nouveaux liens de navigation plus?
-
16-10-2019 - |
Question
Je fais une requête personnalisée à l'aide WP_query pour obtenir des postes d'une catégorie spécifique, mais pour certains liens de navigation raison de la liste ne semble pas. Y at-il un moyen d'obtenir les liens les plus récents / anciens pour montrer et travail en utilisant un WP_query personnalisé?
Voici ce que je fais:
<?php $mainList_query = new WP_Query('cat=4,352,731,754,49,44,54,17&showposts=200&order=DESC'); ?>
<?php if($mainList_query->have_posts()) : while($mainList_query->have_posts()) : $mainList_query->the_post(); ?>
<div class="articleSection">
<h2 class="headlinelist"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="byline2"><?php the_time('F jS, Y') ?> by <?php the_author() ?> at <?php the_time() ?> </div>
<?php if ( in_category( array(754,49,44,54,17) ) ) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/360btn.jpg" width="67" height="16" alt="" />
<?php } ?>
<?php if ( in_category(4) ) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/ps3btn.jpg" />
<?php } ?>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?></p>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
La solution
essayez d'ajouter '& paginée ='. $ Paginée à votre chaîne de requête
<?php $mainList_query = new WP_Query('cat=4,352,731,754,49,44,54,17&showposts=200&order=DESC&paged='.$paged); ?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange