使用這個主題: 主題名稱:二十二 主題URI:https://wordpress.org/themes/twentytwelve/ 作者:WordPress的團隊
安裝這個插件: 總理戰略之頁導航(https://wordpress.org/plugins/prime-strategy-page-navi/)--->的頁面導航 自動編號後(https://wordpress.org/plugins/auto-numbering-post/)--->爲附加編號前面標題
1.打開文件: /wp-content/themes/twentytwelve/index.php
查找這個代碼(第25行):
<?php get_template_part('content', get_post_format()); ?>
REPL王牌與此代碼:
<?php if (function_exists('page_navi')) page_navi('items=7&prev_label=Prev&next_label=Next&first_label=First&last_label=Last&show_num=1&num_position=after'); ?>
<?php /* Start the Loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-title">
<a href="<?php echo get_permalink($recent->ID); ?>">
<?php the_title(); ?>
</a>
</div>
</div><!-- #post -->
<?php endwhile; ?>
<?php if (function_exists('page_navi')) page_navi('items=7&prev_label=Prev&next_label=Next&first_label=First&last_label=Last&show_num=1&num_position=after'); ?>
保存文件並關閉。
2.打開文件:/wp-content/themes/twentytwelve/style.css
在底部,粘貼此代碼:
/* =Style for Page Navigasi
----------------------------------------------- */
.page_navi {
text-align: center;
}
.page_navi li {
display: inline;
list-style: none;
}
.page_navi li.current span {
color: #000;
font-weight: bold;
display: inline-block;
padding: 3px 7px;
background: #fee;
border: solid 1px #fcc;
}
.page_navi li a {
color: #333;
padding: 3px 7px;
background: #eee;
display: inline-block;
border: solid 1px #999;
text-decoration: none;
}
.page_navi li a:hover {
color: #f00;
}
.page_navi li.page_nums span {
color: #fff;
padding: 3px 7px;
background: #666;
display: inline-block;
border: solid 1px #333;
}
保存文件並關閉。
3,這樣的結果:

是清單或目錄文章快樂的主題。
謝謝Gopal,這是做這件事的最好方法嗎?知道wordpress,我確定可以有一個方法調用這個get_page_title(); :) – iCyborg
是的,你可以通過查詢獲取帖子,然後使用get_the_title($ ID)放置標題;通過循環結果。但是在這個查詢代碼中,我只是做了同樣的事情,我只獲得了10個帖子(最好的查詢)並迭代了一個循環,並且只是給它的標題貼上了一個固定鏈接。 ...如果它對你有幫助,你應該接受答案。 –
我們不能硬編碼10,並讓它成爲系統設置/選項頁面中定義的內容嗎? – iCyborg