I created shortcode in my child themes functions.php
file.
The shortcode
is as follows:
function add_login_form() {
if ( is_user_logged_in() )
{
echo 'Witaj zalogowany';
}
else
{
wp_login_form();
}
}
add_shortcode('login_form', 'add_login_form');
I added shortcode [login_form]
to my website (test area):
http://s540141209.domenaklienta.pl/wordpress/konto-klienta/
It is added to website after the text:
“TUTAJ POWINIEN BYÄ LOGIN FORM LUB NAPIS âWITAJ ZALOGOWANYâ!”
It should be inside first div: <div class="et_pb_row">
But it is shown just after the header of a page. Have you any idea why it happens that way?
Thansk in advance.
But it happens to show before everything on website.
See http://codex.wordpress.org/Shortcode_API on how shortcodes acts. In a shortcode function you should always return the result of the processing done in the shortcode action. Echoing it outputs it as soon as the hook is executed, instead of being inserted in where it should be.
For all arguments of wp_login_form, see http://codex.wordpress.org/Function_Reference/wp_login_form .