changing comment textarea placeholder
-
I want to moddify the default text in the comment textarea to be the same as the comment label, though I can not find out how. Changing comment_field in the args section didn’t help (I have succesfully changed ‘logged in as’ though).
I have solved it (as a test) by changing the following function in comment_functions.php:
public function comment_field_label_filter($comment_html) { return preg_replace('/(<label.*>)(.*)(<\/label>)/i', '${1}'.$this->options->get('cgb_form_comment_label').'${3}', $comment_html, 1); }to:
public function comment_field_label_filter($comment_html) { $comment_html = preg_replace('/(placeholder=")(.*)(")/i', '${1}'.$this->options->get('cgb_form_comment_label').'${3}', $comment_html, 1); return preg_replace('/(<label.*>)(.*)(<\/label>)/i', '${1}'.$this->options->get('cgb_form_comment_label').'${3}', $comment_html, 1); }This is, ofcourse, ugly and will break at the next plugin update.
Is there a way to simulate this without editing the plugin directly? I didn’t get it to work with a filter yet. Editing my functions.php with a hardcoded replacement for the placeholder would be okay for me, but I preferably either copy the text from the label or have another input field for the placeholder on the plugin page.
The topic ‘changing comment textarea placeholder’ is closed to new replies.