Skip to content

Instantly share code, notes, and snippets.

@gmaggio
Created July 20, 2014 17:11
Show Gist options
  • Save gmaggio/976276a87b093282e653 to your computer and use it in GitHub Desktop.
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)
<?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