Archived topic
Translating Page Navigation
3 replies · Started by John on July 20, 2022
Hi,
Re: https://www.origamispirit.com/es/page/2/
Site translated with WPML.
At the bottom of the page is pagination delivered with the snippet:
add_action('wp',function(){
remove_action( 'generate_after_loop', 'generate_do_post_navigation' );
});
add_action( 'generate_after_loop', function() {
echo '<div class="paging-navigation">';
posts_nav_link( ' ', '<<< PREVIOUS ', ' NEXT >>>' );
echo '</div>';
});
PREVIOUS and NEXT are not being translated even though I've customized the string in WPLM. I've also cleared server/browser caches but no change.
Any ideas?
Thanks!
John
Hi there,
not sure on that, WPML may be able to advise.
But why not use the default post paging nav ?
You can filter the default text here:
Hi David,
WPML did advise and changed the snippet to the following. WPML was then able to translate these strings. I don't know why I didn't do as you suggested above originally, and I can't find in any of my topics where I found the pagination snippet.
add_action('wp',function(){
remove_action( 'generate_after_loop', 'generate_do_post_navigation' );
});
add_action( 'generate_after_loop', function() {
echo '<div class="paging-navigation">';
$previous = _( '<<< PREVIOUS ', 'my-text-domain' );
$next = _( ' NEXT >>>', 'my-text-domain' );
posts_nav_link(' ',$previous,$next);
echo '</div>';
});
That makes sense - glad to see you got a working solution and thanks for sharing that here!