【发布时间】:2016-01-10 07:14:31
【问题描述】:
我想在 wordpress 博客页面上的帖子上方添加分页,我应该将代码放在哪里? 我正在使用:
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array( ..parameters here.. ) );
?>
和一个自定义循环。如果我把它放在循环下面它工作正常,如果我把它放在循环上面它就不会出现。有解决办法吗?
我的 lopp 看起来像:
<?
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'paged' => $paged,
'posts_per_page'=>12,
'orderby' => 'meta_value_num',
'order' => 'DSC',
'pagination' => 'true',
'cat' => '2'
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
?>
<?php $the_query->the_post(); ?>
<li id="post-<?php the_ID(); ?>"> ...</li> ....
【问题讨论】:
-
我的答案之外的另一件事是访问remicorson.com/…它可能会帮助你。
标签: wordpress pagination