LoginWithAJAX::output( array $args )
Outputs the login form directly to the browser. Ultimately, shortcodes, blocks and other display methods will call this function to output the login form.
Description
You can display a login form via PHP pretty much the same way as you would with the shortcode [lwa]
:
LoginWithAJAX::output(
array(
'template' => 'minimalistic',
'redirection' => 'https://some-special-redirect.com',
'profile_link' => false,
)
);
For more information about the possible configurations in a login form, please visit the login form documentation page as these configurations apply to all methods of displaying the login form. This page will inform you of the right argument names specifically for shortcodes.
Return
This function outputs the login form directly to the browser, use LoginWithAJAX::get_output( $args );
to get the string content instead of outputting it to the browser.
Parameters
$args
(array) is an optional associative array. Below you'll see all the available arguments with their default values.
General Arguments
These are general arguments that apply to whether the user is logged in our out.
Argument | Default | Description |
---|---|---|
template
(string) |
settings default |
The template to be used, which would override the default template choice. Note The value used here would be the registered name of the template (usually uncapitialized with hyphens for spaces), not the label name. The default templates are: default - Defaultminimalistic - Minimalisticmodal - Modalmodal-minimalistic - Modal Minimalistic
|
template_color
(string) |
settings default |
Color base to use for links, buttons etc. in templates. Accepts a hex or hsl CSS format value, such as Note Custom templates may not support this feature. |
css_style
(string) |
none |
Add inline CSS rules to the outer Important Ensure you add a semicolon to the end. This inline CSS you add here is added to the start of the |
css_vars
(array) |
none |
Add custom CSS variables to the outer
Would translate to the following CSS inline rule Important This inline CSS you add here is added to the end of the |
vanilla
(boolean) |
false
|
If set to false, LWA's CSS templating is not applied to this form, making it 'vanilla' and adapts to the CSS styling of your theme. Note Due to every theme having their own unique stying, there may be unexpected results/consistency. Custom templates may not support this feature. |
Login Arguments
These are arguments that apply to when a user is logged out and viewing the login form.
Argument | Default | Description |
---|---|---|
title
(string) |
none | Title text to add above the login form. HTML not admitted and will be escaped to be displayed literally. |
registration
(int) |
1
|
Whether or not to display the Registration link. Accepts the following values: 0 - Do not show1 - Show link with AJAX form2 - Link directly to original form
|
remember
(int) |
1
|
Whether or not to display the password recovery link. Accepts the following values: 0 - Do not show1 - Show link with AJAX form2 - Link directly to original form
|
rememberme
(int) |
1
|
Whether or not to display the Registration link. Accepts the following values: 0 - Do not show1 - Show, unchecked by default2 - Show, checked by default3 - Hide but enabled/checked
|
redirect
(string) |
none |
Where to redirect upon successful login. Accepts a full url, e.g. https://someplace.com If not set, the default redirection options will be used.
|
refresh
(bool) |
true
|
If If set to This value will supercede the |
Logged In Arguments
These are arguments that apply to when a user is logged in and viewing their profile widget.
Argument | Default | Description |
---|---|---|
title_loggedin
(string) |
none |
Title text to add above the user details widget when logged in. HTML not admitted and will be escaped to be displayed literally. The following placeholders can be used to replace wyt dynamic info: %USERNAME% - Do not show |
profile_link
(bool) |
true
|
If |
loggedin_vertical
(bool) |
false
|
If |
avatar_size
(int) |
60
|
The size of the avatar to be displayed, in pixels. Do not include the px, just use a number. |
avatar_rounded
(bool) |
false
|
If |
redirect_logout
(string) |
none |
Where to redirect upon successful logout. Accepts a full url, e.g. https://someplace.com If not set, the default redirection options will be used.
|