Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134312

hrrubin on "Next/previous post links: replace text with image"

$
0
0

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 all articles
Browse latest Browse all 134312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>