The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Include post title ...
 
Share:
Notifications
Clear all

Limited Support

Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.

 

[Solved] Include post title in comment join text

6 Posts
2 Users
1 Reactions
1,121 Views
Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 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. 

5 Replies
Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 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?

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8075

@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.

Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 years ago

Thanks, working! Last question: Is it also possible to change the submit button text only for replies?

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8075

@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. 

Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 years ago

Great, thanks alot. Everything solved! 🙂

Share: