Created
July 20, 2014 17:11
-
-
Save gmaggio/976276a87b093282e653 to your computer and use it in GitHub Desktop.
[Worpress] Add class to next/previous post links (Add class to links generated by next_posts_link & previous_posts_link)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add class to next/previous post links | |
* | |
* Add class to links generated by next_posts_link | |
* and previous_posts_link | |
*/ | |
if ( ! function_exists( 'posts_link_attributes_prev' ) || ! function_exists( 'posts_link_attributes_next' ) ) { | |
function posts_link_attributes_prev() { | |
return 'class="prev"'; | |
} | |
function posts_link_attributes_next() { | |
return 'class="next"'; | |
} | |
add_filter('next_posts_link_attributes', 'posts_link_attributes_prev'); | |
add_filter('previous_posts_link_attributes', 'posts_link_attributes_next'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment