Apr 09, 2022 11:47 pm
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.
5 Replies
Apr 10, 2022 2:46 pm
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?
Apr 11, 2022 9:50 am
Thanks, working! Last question: Is it also possible to change the submit button text only for replies?
Apr 11, 2022 2:04 pm
Great, thanks alot. Everything solved! 🙂