Site logo

Archived topic

Text before the button send comments

3 replies · Started by Diogenes on October 17, 2018

Viewing posts 1–4 of 4

Hi.

I need to add text before the comment button.

This post shows how to place it after the button, but I can not find a reference on how to place it before (between the comments box and the send button)

Thanks for the help.

Hi there,

you can use this filter:

// Add content before comment form submit button
function filter_comment_form_submit_button( $submit_button, $args ) {
    // make filter magic happen here...
    $submit_before = '<div class="custom-class">my content</div>';
    return $submit_before . $submit_button;
};
 
// add the filter
add_filter( 'comment_form_submit_button', 'filter_comment_form_submit_button', 10, 2 );

https://docs.generatepress.com/article/adding-php/

just need to add your HTML to the $submit_before example includes a div container with a custom class which can you change to whatever you need for styling.

Thanks David, it worked perfect.

Greetings.

That's great. Glad to be of help

This archived topic is closed to new replies.