How to change login link in "You must be logged in to post a comment"
-
I use WP User Control Widget and everything wok fine. But when I won’t login in “You must be logged in to post a comment” then I’m redirected to standard background WordPress admin login screen. How or where I can change this and connect this link with WP User Control Widget login or at list with frontend sign in (on page or post)?
Add this to your child theme’s functions.php file. (put the code between
<?phpand?>if the functions.php file is empty)function graphene_custom_comment_form_args( $args ){
$args['must_log_in'] = 'You must be <a href="http://WP-User-Control-login.url">logged in</a> to post a comment.';
return $args;
}
add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );Change
http://WP-User-Control-login.urlto actual URL of WP User Control front end sign in page.Can I also put this in Graphene functions or custom css style, because I don’t use Child theme (I try, but when I activate the Child theme, page is totally messed around)?
No, it’s a php function. You can’t put it in graphene custom CSS. Also, don’t put this in parent theme’s functions.php. It may ruin your site. Consider using a child theme instead. If you ran into any issues after activating the child theme, create a thread in this forum. We’ll try our best to sort it out.
OK, I create functions.php and works fine. I just don’t know how I can find WP login link, WP is only widget and there is no post or page?
Try this. It actually scrolls to WP User Control widget in the same page.
function graphene_custom_comment_form_args( $args ){
$args['must_log_in'] = 'You must be <a href="#wp-user-control-widget-2">logged in</a> to post a comment.';
return $args;
}
add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );If it doesn’t work. change
#wp-user-control-widget-2with the actual ID of WP User Control in your site.I think you can create a custom login link within the widget settings.
Finally manage to find appropriate link: “#login_div”. Where? At the bottom of Chrome browser, when I point to the WP UC Widget. ïŠ
Now it works.
I still learn, but this are great experience.
Thanks, you have awesome support!
Quote:“You must be logged in to post a comment” then I’m redirected to standard background WordPress admin login screen.I am using Login with Ajax and also do not want the link in the sentence to do the above.
Can I just remove the link and/or change the link destination or just the wording of the prompt (without the link) to direct users to the Ajax Register/Login at the top of the page? I do want users to login to post so I have chosen that option in settings, just want them directed to the Ajax Login, not the WordPress Login.
What would you fine brainiacs recommend? 🙂
Thanks again!
Donna
Tried this but it didn’t work to direct to Ajax Login…sigh. I know you guys are busy…so I can be patient on this. 🙂 Thank you!
<?php
function graphene_custom_comment_form_args( $args ){
$args['must_log_in'] = 'You must be <a href="#LoginWithAjax">logged in</a> to post a comment.';
return $args;
}
add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );
?>@lateatlantean link to your site?
- You must be logged in to reply to this topic.
