Replace 'Next / Previous'
-
Hello Eric,
I posted this question in the “Remove Next & Previous” post, but as it is “Resolved” I’m not sure it was the proper way…
So I’m not trying to remove “Next” and “Previous” but I would like to change the text by the TwentyTen’s navigation for the posts pages :
<?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?>(andNewer posts →).I tried copying the TwentyTen’s loop.php navigation lines at the end of posts_loop_template.php but it didn’t work…
Is there a way to do it ?
-
Hello senthilmaster,
Right now there isn’t an easy way to change this using the loop template (if it added it, it would show up under each post)
There is a filter, so you could do drop the following code into your functions.php file:
function posts_in_page_replace_prev_next( $links ){ $links = str_replace( 'Next', 'Older Posts &larr', $links ); $links = str_replace( 'Previous', 'Newer Posts →', $links ); return $links; } add_filter( 'posts_in_page_paginate', 'posts_in_page_replace_prev_next' );That’s perfectly working, thank you so much for your help!
Just a small correction for anybody wishing to do the same, it must be
'← Older Posts'for the arrow to be displayed (the ; was missing), and to be placed before the text 😉Just another question, is there a way to apply an id or a class to each, so that I can style them (for instance float:left and float:right) in my CSS stylesheet?
There isn’t currently a class on each individual link (for prev/next).
The easiest way is to target the parent element div class=”pip-nav” and use first-child or last-child styles to float the elements left or right as needed.
Thank you ivycat, I didn’t know about the first-child/last-child!
So for anybody whishing to achieve the same, here are the 2 lines I added in my Twenty-Ten child-theme’s stylesheet:
#content .pip-nav li:first-child { float: right; } #content .pip-nav li:last-child { float: left; }
The topic ‘Replace 'Next / Previous'’ is closed to new replies.