當前位置:名人名言大全網 - 笑話故事 - wordpress如何添加上壹篇下壹篇的按鈕形式

wordpress如何添加上壹篇下壹篇的按鈕形式

把下面的代碼放進妳所用主題的single.php文件的while主循環之內:

<nav?id="nav-single">

<span?class="nav-previous"><?php?previous_post_link(?$format='<span?class="left-arrow"></span>?%link?',?$link='%title',?$in_same_cat?=?false,?$excluded_categories?=?'');?></span>

<span?class="nav-next"><?php?next_post_link($format='?%link?<span?class="right-arrow"></span>',?$link='%title',?$in_same_cat?=?false,?$excluded_categories?=?'');?></span>

</nav><!--?#nav-single?-->

CSS請參考WP自帶的2013主題的style中的1714-1723行,外加:

.left-arrow:before,.right-arrow:after{

width:?14px;

height:?14px;

display:?inline-block;

padding:?8px?0;

color:?#999;

font:?400?14px/1?dashicons!important;

font-weight:?normal;

font-style:?normal;

speak:?none;

text-align:?center;

vertical-align:?middle;

-webkit-font-smoothing:?antialiased;

-moz-osx-font-smoothing:?grayscale;

-moz-transition:?all?.1s?ease-in-out;

-webkit-transition:?all?.1s?ease-in-out;

transition:?all?.1s?ease-in-out;

}

.left-arrow:before{

content:?"\f340";

}

.right-arrow:after{

content:?"\f344";

} 妳需要在主題前臺載入WP自帶的dashicons才會有左右箭頭出現,如下圖

測試截圖: