笑话大全网 - 爆笑笑话 - 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才会有左右箭头出现,如下图

测试截图: