• I’m using the Admired theme. I want to add text above the comment box. From reading previous threads about adding text, it seems that I have to edit my comments.php. Where should I edit?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You may be able to do what you want by adding an action to the
    ‘comment_form_before’ hook. Try adding something like this to your functions.php:

    add_action( 'comment_form_before', 'my_pre_comment_text' );
    
    function my_pre_comment_text() {
    	echo '<div class="mytext"><p>I want some text here before the comments.</p></div>';
    }

    Of course, you will probably also need to add some styling.

    Thread Starter sugarpeach

    (@sugarpeach)

    Where is the comment_form_before hook located? I cannot find it in the functions.php.

    The code I gave goes into your functions.php. comment_form_before hook is built into WP – it is not in the theme’s files.

    But, be careful, you may need to enclose the code in php tags. If you make a mistake, you may not be able to log in to your site to correct it. Don/t add the code unless you are sure it is going to be OK.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding text above comment box’ is closed to new replies.