WordPress Snippets
Last active
July 22, 2016 20:06
-
-
Save ControlledChaos/03ac40c004c8fea1ec5a601907e10d37 to your computer and use it in GitHub Desktop.
Add classes to links generated by next_ & previous_posts_link.
This file contains 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 | |
// Single class for both links | |
function ccd_posts_link_attributes() { | |
return 'class="next-prev-post"'; | |
} | |
add_filter( 'next_posts_link_attributes', 'ccd_posts_link_attributes' ); | |
add_filter( 'previous_posts_link_attributes', 'ccd_posts_link_attributes' ); | |
?> |
This file contains 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 | |
// Class for each links | |
function ccd_posts_link_attributes_2() { | |
return 'class="next-post"'; | |
} | |
function ccd_posts_link_attributes_1() { | |
return 'class="prev-post"'; | |
} | |
add_filter( 'next_posts_link_attributes', 'ccd_posts_link_attributes_1' ); | |
add_filter( 'previous_posts_link_attributes', 'ccd_posts_link_attributes_2' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment