juandahveed
9/28/2017 - 1:15 PM

add a class to the wordpress functions that customize and create blog PREV and NEXT links

add a class to the wordpress functions that customize and create blog PREV and NEXT links

// add class to the next and previous blog page links
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');

function posts_link_attributes() {
    return 'class="blog_pagination"';
}

// add class to the next and previous indiviaul blog post links
add_filter('next_post_link', 'post_link_attributes');
add_filter('previous_post_link', 'post_link_attributes');
 
function post_link_attributes($output) {
    $code = 'class="blog_pagination"';
    return str_replace('<a href=', '<a '.$code.' href=', $output);
}