The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
[Solved] Include post title in comment join text
✦ Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
How-to and Troubleshooting
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Apr 10, 2022 3:47 am
(@jave)
Eminent Member
Joined: 4 years ago
Hello,
is there a way to include the post title inside the comment join text (the placeholder)?
I would like to change it dynamically according to the current post to something like:
"What are your thoughts about 'post title' ?"
Maybe this is archivable with a simple snippet?
Thanks in advance.
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Apr 10, 2022 6:46 pm
(@jave)
Eminent Member
Joined: 4 years ago
Got it working with this:
add_filter("wpdiscuz_phrase", function ($phrase, $key, $args) {
if ($key === "wc_comment_join_text") {
$title = get_the_title(get_queried_object_id());
$phrase = str_replace("Kommentar", "What are your thoughts about $title ?" , $phrase);
}
return $phrase;
}, 10, 3);
But now there results another question out of it: As the placeholder is the same like in reply to textarea it doesn't fit anymore. How can I hide the placeholder only in reply to form but keep it in the main comment form?
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8208
Apr 11, 2022 11:39 am
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@jave,
You can use the CSS code:
#wpdcom form.wpd_comm_form.wpd-secondary-form-wrapper .ql-editor::before{
display: none;
}
Put the code in the Top Admin Bar > Customize > Additional CSS > "Additional CSS" textarea, save it, delete all caches and check again.
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Apr 11, 2022 1:50 pm
(@jave)
Eminent Member
Joined: 4 years ago
Thanks, working! Last question: Is it also possible to change the submit button text only for replies?
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8208
Apr 11, 2022 2:40 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@jave,
You should use some JS code like this:
jQuery(document).ready(function(){
jQuery('#wpdcom #wpdiscuz_hidden_secondary_form input[type="submit"]').attr("value", "Your text");
});
This article should be helpful for you: https://www.collectiveray.com/add-javascript-to-wordpress
Change the red marked value as you like.
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Apr 11, 2022 6:04 pm
(@jave)
Eminent Member
Joined: 4 years ago
Great, thanks alot. Everything solved! 🙂