我们使用以下两个函数来显示分页。
<?php next_posts_link( 'Older Entries »'); ?>
<?php previous_posts_link( 'Newer Entries »'); ?>以上两个函数将输出如下所示的内容
<a href="page link goes here">Older Entries »</a>
<a href="page link goes here">Newer Entries »</a>有没有任何方法添加额外的属性与锚链接??
如:
<a href="page link goes here" class="name of the class" data-hover="Previous">Older</a>发布于 2015-01-01 14:28:38
我很少搜索,而且做了这件工作。
add_filter('next_posts_link_attributes', 'posts_link_attributes_1');
add_filter('previous_posts_link_attributes', 'posts_link_attributes_2');
function posts_link_attributes_1() {
return 'data-hover="Next" class="your class here"';
}
function posts_link_attributes_2() {
return 'data-hover="Previous" class="your class here"';
}https://wordpress.stackexchange.com/questions/173700
复制相似问题