Archived topic
Hello how to translate Next and Previous buttom?
13 replies · Started by Mr Calvert on March 10, 2021
Can you give me function to translate Next and Previous buttom in blog and category?
Hi there,
You can translate that using gettext filter.
Example: Translating to Filipino
add_filter( 'gettext', function( $text ) {
if ( 'Previous' === $text ) {
$text = 'Nakaraan';
}
if ( 'Next' === $text ) {
$text = 'Susunod';
}
return $text;
} );
You can change 'Nakaraan' and 'Susunod' to the language you prefer to translate into.
Yes! Thanks you so much!!!
No problem. :)
Hello I was try but it not work!
Can you check for me I was attack URL
Hi there,
i am seeing this:
https://www.screencast.com/t/DSapMMiw63
Is this correct ?
If it isn't then you need to ensure the conditional string eg.
if ( 'Previous' === $text ) {
matches your current text.
It not work! I was edit in main theme, I was remember I edit file post-meta.php
Can you give me right function to add child theme? Because it was lost when I update theme
Try this snippet instead:
add_filter( 'generate_previous_link_text', function() {
return 'your previoius link text';
} );
add_filter( 'generate_next_link_text', function() {
return 'your next next link text';
} );
Hello. I was changed. But it was remove arrow "<-". Can you help me code keep like default of your theme.
I was try this but code wrong.
add_filter( 'generate_previous_link_text', function() {
sprintf(
/* translators: left arrow */
__( '%s Previous', 'generatepress' ),
'<span aria-hidden="true">←</span>'
)
} );
It not work. Can you help me code add filter and keep default of Generate Press?
Can you help me fix that function. I was try fix a lot but it not useful!!!
Try this:
add_filter( 'generate_previous_link_text', function() {
return sprintf('%s Your Previous Text', '<span aria-hidden="true">←</span>');
} );
add_filter( 'generate_next_link_text', function() {
return sprintf('Your Next Text %s', '<span aria-hidden="true">→</span>');
} );
Hi,
add_filter( 'generate_previous_link_text', function() {
return 'your previoius link text';
} );
add_filter( 'generate_next_link_text', function() {
return 'your next next link text';
} );
the code above is not working for me... Please help!
Hi Tesco,
Can you open a new topic and link us to the page in question?
Thanks!