Forked from robgolbeck/WordPress Add Attributes to previous_posts_link and next_posts_link
Created
July 18, 2017 14:11
-
-
Save gagimilicevic/491f7f3af9cadcdce3a494e3b45e1f96 to your computer and use it in GitHub Desktop.
WordPress Add Attributes to previous_posts_link and next_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 | |
// E.g. title or rel attritutes. | |
// via https://wordpress.org/support/topic/need-previous_posts_link-next_posts_link-has-title-and-rel#post-1068032 | |
add_filter('next_posts_link_attributes', 'get_next_posts_link_attributes'); | |
add_filter('previous_posts_link_attributes', 'get_previous_posts_link_attributes'); | |
if (!function_exists('get_next_posts_link_attributes')){ | |
function get_next_posts_link_attributes($attr){ | |
$attr = 'rel="myrel" title="mytitle"'; | |
return $attr; | |
} | |
} | |
if (!function_exists('get_previous_posts_link_attributes')){ | |
function get_previous_posts_link_attributes($attr){ | |
$attr = 'rel="myrel" title="mytitle"'; | |
return $attr; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment