Automatically add classes to links generated by next_posts_link and previous_posts_link

Paste the following code in your functions.php file:

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

function posts_link_attributes() {
    return 'class="myclass"';
}

Thanks to CSS Tricks for the function!

Leave a Reply

Your email address will not be published. Required fields are marked *