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代碼