Archived topic
Translate Day: in arhive page
12 replies · Started by NIKOLAY on November 3, 2020
Dear GeneratePress,
I'm trying to translate the the Word ‘Day:’ in arhive page (https://webpage/?m=YYYYMMDD). However I cannot find out where to change. Neither with Loco translate plugin or the file structure. Can you help me?
Have a pleasant day.
Nikolay
Hi there,
so you want to translate the URL ?
Hi David,
No. After header and before the content of archive page, just above the 1st title of post from any day is says
(Day: 03.11.2019). I just want to translate 'Day' in my language. I could not find that string in Generetepress theme or wordpress.
Regards: Nick
Can you share a link where i can see this?
yes sure.. I wll add in private information bellow
Same problem I have with next or to the previous text as well
Hi there,
The "Day: " text is provided by WordPress itself. You can find it here: https://developer.wordpress.org/reference/functions/get_the_archive_title/
A translation plugin should be able to change that string. However, it should be translated automatically if you've chosen your language in "Settings > General".
As for the next/previous text - where can I see that?
Hi,
For the previous/next text displays, you can use this PHP snippet:
add_filter( 'generate_next_link_text', function() {
return 'следующий';
} );
add_filter( 'generate_previous_link_text', function() {
return 'предыдущий';
} );
You can change the return values to any text string you prefer.
Here's how to add PHP - https://docs.generatepress.com/article/adding-php/
Thanks for your help.
I add it this PHP snippet as Hook Elelemts after body tag in entire web site.
Best regards: Nick
Hi there,
add_filter hooks should not be placed in the Hook elements, as they should not be executed on the front end, although the may work you should add them using one of the methods here:
Thanks for your help David!
I did what you suggest - deleted hook element and create my custom plugin where I run the PHP snippet of add_filter.
With hook elements was working too but I agree with you that via custom plugn is much safer for my web.
Regards,
Nick
Glad to hear that!