WordPress.org

Support

Support » Miscellaneous » [Resolved] Where to find this text and change it

[Resolved] Where to find this text and change it

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Michael

    @alchymyth

    Forum Moderator

    this is some of the outputs of comment_form()

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

    try to add this to functions.php of the child theme:

    add_filter( 'comment_form_defaults', 'twentyelevenchild_modify_comment_fields' );
    
    function twentyelevenchild_modify_comment_fields( $fields ) {
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $fields['logged_in_as'] = '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>';
    
    return $fields;
    }

    (the above is still the original text)

    It worked, alchymyth. Thank you!

    btw, alchymyth, I want to add this to functions.php too:

    <p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>

    But I’ll have to add some text to make it work right? Could please me. What do I need to add to this code?

    Thank.

    Moderator Michael

    @alchymyth

    Forum Moderator

    add it to the filter:

    add_filter( 'comment_form_defaults', 'twentyelevenchild_modify_comment_fields' );
    
    function twentyelevenchild_modify_comment_fields( $fields ) {
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $fields['logged_in_as'] = '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>';
    $fields['must_log_in'] = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>';
    return $fields;
    }

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Where to find this text and change it’ is closed to new replies.