Skip to main content

Using Shortcodes

The Shortcode​

AJAX Auth has one shortcode, since it's inception in 2009! This shortcode is [login-with-ajax] or [lwa] which will display the login form.

If used on its own, the default arguments will be used, along with default settings chosen via the settings page. Below you'll see all the available arguments with their default values.

Shortcode Arguments​

Shortcode arguments (parameters) can be passed on within either of our shortcodes. For example, [lwa template="minimalistic" remember="0"] would display the login form using the Minimalistic without the 'remember me' checkbox. Below is a list of all the possible arguments.

info

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.

General Arguments​

These are general arguments that apply to whether the user is logged in our out.

ArgumentDefaultDescription
templatesettings defaultThe 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 - Default
minimalistic - Minimalistic
modal - Modal
modal-minimalistic - Modal Minimalistic
template_colorsettings defaultColor base to use for links, buttons etc. in templates. Accepts a hex or hsl CSS format value, such as #123abc or 10,100%,50% (do not wrap hsl values in hsl())

Note Custom templates may not support this feature.
css_stylenoneAdd inline CSS rules to the outer .lwa class located in your template files. This can include any CSS rules such as margin:10px; or our custom CSS variables such as --background-color:#FFFFFF;

Important Ensure you add a semicolon to the end. This inline CSS you add here is added to the start of the style="...", further rules maybe added dynamically during output.
vanilla

(boolean)
0If set to 0, AJAX Auth'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.

ArgumentDefaultDescription
titlenoneTitle text to add above the login form. HTML not admitted and will be escaped to be displayed literally.
registration1Whether or not to display the Registration link. Accepts the following values:

0 - Do not show
1 - Show link with AJAX form
2 - Link directly to original form
remember1Whether or not to display the password recovery link. Accepts the following values:

0 - Do not show
1 - Show link with AJAX form
2 - Link directly to original form
rememberme1Whether or not to display the Registration link. Accepts the following values:

0 - Do not show
1 - Show, unchecked by default
2 - Show, checked by default
3 - Hide but enabled/checked
redirectnoneWhere to redirect upon successful login. Accepts a full url, e.g. https://someplace.com If not set, the default redirection options will be used.
refresh1Whether or not to refresh the page upon a successful login. Accepts values 0 (no) or 1 (yes).

If set to 0, the login form (or modal button) will be replaced with a logged in widget instead.

This value will supercede the redirect option and will prevent redirection if refreshing is disabled.

Logged In Arguments​

These are arguments that apply to when a user is logged in and viewing their profile widget.

ArgumentDefaultDescription
title_loggedinnoneTitle 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_link1Whether or not to display a link to the user profile page. Accepts values 0 (no) or 1 (yes).
loggedin_vertical0Whether or not to show a vertical style, where avatar apears on top, links below. Accepts values 0 (not vertical) or 1 (vertical).
avatar_size60The size of the avatar to be displayed, in pixels. Do not include the px, just use a number.
avatar_rounded0Whether or not to show the avatar as a circular picture rather than a square. Accepts values 0 (no) or 1 (yes).
redirect_logoutnoneWhere to redirect upon successful logout. Accepts a full url, e.g. https://someplace.com If not set, the default redirection options will be used.