Tagged: x
-
AuthorPosts
-
October 20, 2016 at 2:47 pm #1224361
Hi,
Can you tell me how I must translate: “You must be logged in to post a comment.” in the post section from users?
For example: https://forevermusic.nl/fm-final/versterker-line6-flextone-2-e-100/
This textline is not located in the .mo file or in my functions.php in my child-theme.Thanks
BoukeOctober 20, 2016 at 9:19 pm #1224841Hello There,
Thanks for writing in! The said phrase is coming from the WordPress comment form defaults. You may override that by adding the following code in your child theme’s functions.php file
/** * Modify the "must_log_in" string of the comment form. * * @see http://wordpress.stackexchange.com/a/170492/26350 */ add_filter( 'comment_form_defaults', function( $fields ) { $fields['must_log_in'] = sprintf( __( '<p class="must-log-in"> You must <a href="%s">Register</a> or <a href="%s">Login</a> to post a comment.</p>' ), wp_registration_url(), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ); return $fields; });
Please do not forget to translate and make sure that you have the correct format.
Hope this helps.
October 21, 2016 at 2:18 am #1225076Thanks for your answer. I placed this code:
add_filter( 'comment_form_defaults', 'wpsites_comment_form_defaults' ); $fields['must_log_in'] = sprintf( __( '<p class="must-log-in"> Wil je een reactie geven op deze vette post? <a href="%s">Registreer</a> je <a href="%s">Login</a> dan hier!</p>' ), wp_registration_url(), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ); return $fields
;
in my functions.php in my child-theme but nothing happen yet. Any idea what goes wrong?
When I add a extra class in: <p class=”must-log-in test”> is this class not visible in the editor from the browser…Thanks!
October 21, 2016 at 2:22 am #1225079Hi,
There a syntax error in your code.
Kindly change it with this.
/** * Modify the "must_log_in" string of the comment form. * * @see http://wordpress.stackexchange.com/a/170492/26350 */ add_filter( 'comment_form_defaults', function( $fields ) { $fields['must_log_in'] = sprintf( __( '<p class="must-log-in"> Wil je een reactie geven op deze vette post? <a href="%s">Registreer</a> je <a href="%s">Login</a> dan hier!</p>' ), wp_registration_url(), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ); return $fields; });
Hope that helps.
October 21, 2016 at 2:32 am #1225088Thanks,
Still getting 2 errors. see the printscreen for the details.
October 21, 2016 at 2:54 am #1225110Hello There,
Please use this code instead:
/** * Modify the "must_log_in" string of the comment form. * * @see http://wordpress.stackexchange.com/a/170492/26350 */ function modify_must_login( $fields ) { $fields['must_log_in'] = sprintf( __( '<p class="must-log-in"> Wil je een reactie geven op deze vette post? <a href="%s">Registreer</a> je <a href="%s">Login</a> dan hier!</p>' ), wp_registration_url(), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ); return $fields; } add_filter( 'comment_form_defaults', 'modify_must_login' );
Hope this helps.
October 21, 2016 at 3:03 am #1225117Thanks that fixed the error! Can i do the same for the comment-reply-login class with the Log in to Reply text?
https://forevermusic.nl/fm-final/test-3-jaar-oud-pioneer-ddj-wego-3-zwart/Do you have a little example for this one?
October 21, 2016 at 3:28 am #1225131Hello There,
To modify the login text in the comments section, please check out this link:
https://developer.wordpress.org/reference/functions/get_post_reply_link/Hope this helps.
October 21, 2016 at 3:53 am #1225159Hi Rue,
Thanks but I fix this with a none display in the css because this extra login comment doesn’t make sense in the posts.
That makes this topic fixeds. Thanks and have nice day.
October 21, 2016 at 4:09 am #1225177Hello There,
We are just glad that you have figured it out a way to correct the said issue.
Thanks for letting us know!Best Regards.
-
AuthorPosts