-
AuthorPosts
-
September 10, 2024 at 8:22 pm #1466646
I want to change the word above masonry title of password protected content. In german the word is: Geschützt
How can i do that? I mean the word in Masonry, that give users the information that the content is password protected.
I do not mean the text on the site, where you have to fill in the password.
September 11, 2024 at 5:58 am #1466655September 11, 2024 at 8:28 am #1466658Normally, the word “Protected:” (Geschützt:) is placed in front of the title of the post, and the date of creation is displayed below it.
So have you already made any changes there?September 11, 2024 at 8:40 am #1466659Hello Günni! I wanted you to answer. It seems to be your specialty. No, I haven’t changed anything. I want it to say “VIP membership required” instead of “Protected”.
September 11, 2024 at 8:55 am #1466661I can’t find the passage either in one of the Enfold files or in the Lang files of the translation for the various languages.
The maximum you can always find is “password protected” – so it seems to be a WordPress setting.Hooray – there are WordPress filters that do that: try in your child-theme functions.php:
function change_protected_title_prefix() { return 'VIP membership required: %s'; } add_filter('protected_title_format', 'change_protected_title_prefix');
if it is the german version you had to translate it by yourself
if you do not like the double dot – get rid of itPS: if you like to use quotes inside that phrase you had to use entities f.e.:
function change_protected_title_prefix() { return 'VIP’s only: %s'; } add_filter('protected_title_format', 'change_protected_title_prefix');
_________
by the way: if the post is private – and you do list themfunction change_private_title_prefix() { return 'Admins only: %s'; } add_filter('private_title_format', 'change_private_title_prefix');
September 11, 2024 at 9:30 am #1466667Wow, that’s it! Thank you so much Günni. I appreciate that.
September 11, 2024 at 9:44 am #1466673September 11, 2024 at 10:36 am #1466683One question at last please.
How can i remove the very last sentence of the pw protection page where you hav to write the password?It is: This post is password protected. Please enter the password to access the comments.
September 11, 2024 at 10:51 am #1466684September 11, 2024 at 11:08 am #1466685You can manage it by having your own translation files in your child themes folder. But it’s too much fiddling for just one phrase.
try:
function my_text_strings( $translated_text, $text, $domain ){ switch ( $translated_text ){ case 'here is the exact existing phrase' : $translated_text = __( 'Here is the new phrase', $domain ); break; } return $translated_text; } add_filter('gettext', 'my_text_strings', 20, 3);
__________
function my_text_strings( $translated_text, $text, $domain ){ switch ( $translated_text ){ case 'Dieser Beitrag ist passwortgeschützt. Bitte gib das Passwort ein, um Zugang zu den Kommentaren zu erhalten.' : $translated_text = __( 'Here is the new phrase', $domain ); break; } return $translated_text; } add_filter('gettext', 'my_text_strings', 20, 3);
Sollte das so nicht gehen, nimm die englische Original Phrase links und rechts deine Deutsche Phrase.
( ‘This post is password protected. Enter the password to view any comments.’)September 11, 2024 at 11:17 am #1466687Die Methode über eigene Sprachfiles ( de_DE_formal.po/de_DE_formal.mo und de_DE.po/de_DE.mo) ist prinzipiell sauberer.
Dazu müsstest du die po files bearbeiten und eine Kopie (vorzugsweise in den Ordner “lang”) im child-theme folder platzieren.
Dem Thema muss man dann noch sagen wo die Files liegen:function overwrite_language_file_child_theme() { $lang = get_stylesheet_directory().'/lang'; return $lang; } add_filter('ava_theme_textdomain_path', 'overwrite_language_file_child_theme');
Bearbeiten kannst du die Files mittels poedit – Du musst dort die englische Phrase finden, und die neue deutsche Übersetzung dann einfügen. ( es kann mehrere Stellen geben wo das auftritt.) Poedit speichert dann beide Versionen (po/mo) ab. Diese in den Lang Ordner hochladen.
Deutsch ist nochmal ein Sonderfall, weil es meherer Sprachfiles auch schon wegen Du/Sie gibt.
___________________
The method using your own language files ( de_DE_formal.po/de_DE_formal.mo and de_DE.po/de_DE.mo) is generally cleaner.
To do this, you would have to edit the po files and place a copy (preferably in the ‘lang’ folder) in the child-theme folder.
You then have to tell the theme where the files are located:see codesnippet above
You can edit the files using poedit – you must find the English phrase there and then insert the new German translation. (There may be several places where this occurs.) Poedit then saves both versions (po/mo). Upload them to the Lang folder.
German is another special case, because there are already several language files because of different salutations: Du / Sie.
September 11, 2024 at 11:30 am #1466690Ich wollte diesen letzten Satz komplett entfernen.
September 11, 2024 at 11:42 am #1466692Das denke ich kannst du mit css und dem geeigneten Selektor am besten.
Habe leider keine Beispielseite, wo ich den selektor dir nennen könnte. Hast du auf der Jordan Seite ein Beispiel?#top.single .post-entry.post-password-required ~ p { display: none; }
if it is always the last paragraph this might help!
September 11, 2024 at 5:38 pm #1466732I am so thankfull again, Günni. Dankeschön!
-
AuthorPosts
- The topic ‘Change the word above masonry title of password protected content’ is closed to new replies.