add a class to next/prev post and posts links
<?php
// Add class to links generated by next_posts_link and previous_posts_link,
// see https://css-tricks.com/snippets/wordpress/add-class-to-links-generated-by-next_posts_link-and-previous_posts_link/
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
function posts_link_attributes() {
return 'class="button"';
}
// Add class to links generated by next_post_link and previous_post_link,
// see http://wordpress.stackexchange.com/questions/17218/how-to-add-css-class-to-previous-post-link-or-get-previous-next-post-link-url
function posts_link_next_class($format){
$format = str_replace('href=', 'class="button" href=', $format);
return $format;
}
add_filter('next_post_link', 'posts_link_next_class');
function posts_link_prev_class($format) {
$format = str_replace('href=', 'class="button" href=', $format);
return $format;
}
add_filter('previous_post_link', 'posts_link_prev_class');
?>