Skip to content

Instantly share code, notes, and snippets.

@d8vjork
Last active September 14, 2017 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d8vjork/84e2f1c1e10a5f66c88b2587777aabf0 to your computer and use it in GitHub Desktop.
Save d8vjork/84e2f1c1e10a5f66c88b2587777aabf0 to your computer and use it in GitHub Desktop.
Customize link attributes of WordPress
/**
* Add this in your functions.php
*/
add_filter('next_post_link', 'post_link_attributes');
add_filter('previous_post_link', 'post_link_attributes');
function post_link_attributes($output) {
$injection = 'class="styled-button"';
return str_replace('<a href=', '<a '.$injection.' href=', $output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment