0
我已经在SE网络和WP论坛和几个日志中读过几个答案。但我仍然处于黑暗中。首先,我不得不说,我的后果是不同的。wp_pagenavi在自定义博客档案
- 我创建了一个页面模板
Blog
(blog.php的),并增加了一个wp_query该网页上显示在该职位正常的博客文章,因为我的主页是一个静态网页。 - 然后,我只是创建了永久链接/博客
- 下一页空白名为博客页面,我加wppagenavi对GE之后
elsewhile
- 它没有工作,所以我读了几SOF的答案,并加入
<?php wp_pagenavi(array('query' => $the_query)); ?>
。 - 它显示页面导航,但不工作。我按2,3,4 ...按钮,它虽然URL变化同一页面返回
/blog/page/2
那么,如何让页面导航的工作? 我的片段
<?php $the_query = new WP_Query('showposts=8'); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<div class="content-box bg-wrap"><?php
if (has_post_thumbnail()) { ?>
<div class="img"><a href="<?php the_permalink(); ?>">
<?php
the_post_thumbnail('blog_thumb');
?>
</a></div>
<?php
}
?>
<div class="post-info p20px">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="post-meta"><span class="theauthor"><i class="fa fa-user"></i> <?php echo get_the_author(); ?></span> <span class="thetime"><i class="fa fa-clock-o"></i> <?php the_date(); ?></span> <span class="thecategory"><i class="fa fa-tags"></i><?php the_category(', '); ?></span> <span class="thecomments"><i class="fa fa-comments"></i><?php echo $write_comments; ?></span> </div>
<br/>
<?php echo substr(get_the_excerpt(), 0,600); ?> <a href="<?php the_permalink(); ?>">Read this post »</a>
</div>
</div>
<?php endwhile;?>
<?php wp_pagenavi(array('query' => $the_query)); ?>
不要打扰其他函数和变量或HTML。我只需要让pagenavi工作。 我从here得到了pagenavi代码