HOWTO: Add Custom Classes to Post Navigation Links
Sometimes you just need to have a bit more control over the display of the post navigation (next_posts_link, previous_posts_link). You can easily add in your own custom classes by adding the code below to your theme’s functions.php file. In the example below – I added in a custom class “older” and “newer”. You can add in anything there you would like.
1 2 3 4 5 6 7 8 9 | add_filter( 'next_posts_link_attributes' , 'sdac_next_posts_link_attributes' ); function sdac_next_posts_link_attributes(){ return 'class="older"' ; } add_filter( 'previous_posts_link_attributes' , 'sdac_previous_posts_link_attributes' ); function sdac_previous_posts_link_attributes(){ return 'class="newer"' ; } |