新增外掛:WP-PageNavi

LINEで送る
[`evernote` not found]

隨著文章的增加
要翻頁沒有頁數真是越來越麻煩了
這次啟用的是WP-PageNavi
啟用後要改一下PHP
我動了

  • inidex.php
  • archive.php
  • category.php


把裡面預設的

73
74
75
<div class="navigation">
    <?php posts_nav_link(); ?>
</div>

改成:

61
62
63
64
65
66
67
    <div class="navigation">
      <?php if(function_exists('wp_pagenavi')): ?>
      <?php wp_pagenavi(); ?>
      <?php else : ?>
      <?php posts_nav_link(); ?>
      <?php endif; ?>
    </div>

程式碼會往上升是用DREAMWEAVER重新排過^^”
順便也改了一下single.php

65
66
67
68
69
70
71
72
    <div class="navigation">
      <div id="prenavi">
        <?php previous_post_link('&laquo; %link') ?>
      </div>
      <div id="nextnavi">
        <?php next_post_link('%link &raquo;') ?>
      </div>
    </div>

之後在改一下style.css

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
.navigation{
text-align:center;
margin:2px 0 5px 0;
padding: 10px 0 0 0;
font-size: 12px;
width:400;
}
.navigation #nextnavi{
	float:right;
	width:195;
}
.navigation #prenavi{
	float:left;
	width:195;
}