hi. how can i add a login area inside the avia layout builder?
Hi corneliaboehm!
Please add following code to Functions.php file in Appearance > Editor
add_action( 'init', 'my_add_shortcodes' );
function my_add_shortcodes() {
add_shortcode( 'my-login-form', 'my_login_form_shortcode' );
}
function my_login_form_shortcode() {
if ( is_user_logged_in() )
return '';
return wp_login_form( array( 'echo' => false ) );
}
then you can display your login form using this shortcode
[my-login-form]
Regards,
Yigit
Thank you Yigit. i have added the code. But i cannot see the login :)
Hi!
That is because you are already logged in :)
It is visible to logged out users. Please see screenshot in private content field
Cheers!
Yigit
Great. Thank you.
Is there a way to show a “logout” button when im logged in already?
Hi!
Please change the code in Functions.php file to following one
add_action( 'init', 'my_add_shortcodes' );
function my_add_shortcodes() {
add_shortcode( 'my-login-form', 'my_login_form_shortcode' );
}
function my_login_form_shortcode() {
if ( is_user_logged_in() )
return wp_logout_url();
return wp_login_form( array( 'echo' => false ) );
}
Best regards,
Yigit