Created
November 14, 2016 17:23
-
-
Save JudeRosario/a8853b4d7ebf037e13f0203da40ca0ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_shortcode('login-form', 'i332i_login_form_shortcode'); | |
| function i332i_login_form_shortcode( $attr ) { | |
| if ( is_user_logged_in() ) | |
| return ''; | |
| /* Set up some defaults. */ | |
| $defaults = array( | |
| 'label_username' => 'Username', | |
| 'label_password' => 'Password', | |
| 'redirect' => site_url(), | |
| ); | |
| /* Merge the user input arguments with the defaults. */ | |
| $attr = shortcode_atts( $defaults, $attr ); | |
| /* Set 'echo' to 'false' because we want it to always return instead of print for shortcodes. */ | |
| $attr['echo'] = false; | |
| return wp_login_form( $attr ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment