Change "Leave a Reply" Text

  • Anonymous

    #3590

    Hi there, I searched for this topic before posting and found this one: https://forum.graphene-theme.com/graphene-support/leave-comment-graphics

    But, it looks like the file has changed since the last update. I would like to change the text that says “Leave a Reply” above the comments. Does anyone know which file this is in now?

    Mod

    Kenneth John Odle

    #25138

    I added this to my child theme’s functions file and it still works quite well:

    add_filter('comment_form_defaults','comment_reform');
    function comment_reform ($arg) {
    $arg['title_reply'] = __('If you've read this far, you have to leave a comment. That's the rule.');
    return $arg;
    }

    You, of course, would want to change the text to something else, although you are free to use mine.

    If you do use something with apostrophe’s or quotation marks, be sure to escape them.

    Anonymous

    #25139

    Just to be clear, you are referring to the function.php file? This should be editable from another file should it not?

    Anonymous

    #25140

    It’s actually functions.php

    You want to create a child theme and create a new functions.php file in your child theme directory. There, you can place your custom functions which will be added to the main theme’s functions.php file when loaded by the browser.

    Anonymous

    #25141

    I have educated myself on child themes and set one up..what a relief! Kenneth, your code worked beautifully. Now I would like to change the text that says “Your email address will not be published. Required fields are marked *” just above the comment section. Do you happen to have a snippet for that as well?

    Anonymous

    #25142

    You can try this:

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'Your email address will not be published. Required fields are marked
    <span class="required">*</span>' => 'Whatever Text', // Change "Whatever Text" to what you would like to show.
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

    Anonymous

    #25143

    Hmmm.. That doesn’t appear to be changing anything. I’m still getting the original text.

    Anonymous

    #25144

    Okay, this one has me baffled.

    Syahir, can you point me in the right direction for this.

    Here is the code from the comments.php file:

    'comment_notes_before' => '<p class="comment-notes">'.__( 'Your email address will not be published.', 'graphene' ).'</p>',

    But the text on an actual page for a non-logged in user is as follows:

    “Your email address will not be published. Required fields are marked *”

    I don’t see anything about “Required fields are marked *”

    I’ve tried modifying the comment_notes_before via the child theme.. filtering it to various hooks. I’m stuck.

    Admin

    Syahir Hakim

    #25145

    That string comes from WordPress, not the theme. That’s why you don’t see it in the theme’s comments.php file.

    Anonymous

    #25146

    Gotcha. This page was the closest I got to finding an explanation:

    http://codex.wordpress.org/Function_Reference/comment_form#Uses_filter_hooks

Viewing 10 posts - 1 through 10 (of 10 total)

  • You must be logged in to reply to this topic.