• Hi,

    I am a new blogger and very new to the programming world. I use the theme Sugar and Spice for my site lkamar.com. This theme (in my case) doesn’t show the default message “your email address is required but will not be published. Required fields are marked*” above the comment bar.
    I only have “leave reply” but I want my readers to know that their email address will not be published.
    I have already tried to change it in the functions.php file but it did not work.
    So my question is: Can I change the “leave reply” text into the text I want? And how? Or how can I add text above the comment bar?

    Thanks in advance!

    Luna

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try putting this in your theme’s functions.php:

    function my_comment_form_defaults( $defaults ) {
    
            $defaults['title_reply'] = __('Leave a comment');
            $defaults['comment_notes_before'] = '<p class="comment-notes">' . __( 'Your email adress will not be published.' ) . '</p>';
            return $defaults;
    }
    add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );
    Thread Starter Luna-204

    (@luna-204)

    Hi,

    I put the recommended code in functions.php and when I pressed on “update file” this error appeared:

    Parse error: syntax error, unexpected ‘&’, expecting ‘]’ on line 293

    But there’s no “&” on line 293 or any of the lines before…. And now the error appears whatever I press (I can’t even logout).

    Sorry for bothering you again!

    What did you use to copy/paste that code? And where and how did you paste it?

    Thread Starter Luna-204

    (@luna-204)

    Maybe I’ve messed it up completely and did everything wrong.
    But this is exactly what I did:

    – I went to Appearence –> Editor –> Theme functions (functions.php) on my WP-admin

    – I scrolled down till the end

    – Selected the code you gave me, right click –> copy

    – Went back to my WP functions.php and pasted it under what was already there

    – I pressed Update file and then the Parse error appeared…

    – I also tried to remove the code and Update again but the same error came back

    – Also: line 293 is not even part of the new code but it’s something that was already part of the theme and I didn’t change anything about that

    OK a quick fix here would be to upload an unedited version of the functions.php file from your theme. You’ll need to use FTP or better to do so.

    I know WordPress allows you to edit theme and plugin files from its built-in editor, but a good rule of thumb is never ever do that. It’s infinitely better to edit a file in a proper text editor.

    Thread Starter Luna-204

    (@luna-204)

    Hi again,

    Thanks a lot for the (fast) help and tips! It’s fixed now.

    Luna

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Text before comment bar’ is closed to new replies.