• I’m looking for a solution regarding the next/previous post links found on individual posts (or the single.php file).

    This is the default state in Responsive Theme:

    <div class="navigation">
    <div class="previous"><?php previous_post_link( '%link' ); ?></div>
    <div class="next"><?php next_post_link( '%link' ); ?></div>
    </div>

    But I want to add a class to each, adding a background to the link and removing the text. According to several sites, this should work.

    add_filter('next_posts_link_attributes', 'posts_link_attributes_1');
    add_filter('previous_posts_link_attributes', 'posts_link_attributes_2');
    
    function posts_link_attributes_1() {
    	return 'class="prev-post"';
    }
    function posts_link_attributes_2() {
    	return 'class="next-post"';
    }

    Is the %link specific to this theme? What will I need to change?

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Next/previous post links: replace text with image’ is closed to new replies.