为 next_posts_link 和 previous_posts_link 生成的链接添加类

Avatar of Chris Coyier
Chris Coyier

这两个函数创建锚链接,你可以自定义很多东西,但是仅通过使用它们的 parameter 无法添加类。必须添加一个函数到 functions.php 中。

add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');

function posts_link_attributes() {
  return 'class="styled-button"';
}