-
-
Save awakekat/9c3507d1c6bafc4d2a70 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
// Creates Login Shortcode | |
// Shortcode Usage: [loginform redirect="http://my-redirect-url.com"] | |
function pippin_login_form_shortcode( $atts, $content = null ) { | |
extract( shortcode_atts( array( | |
'redirect' => '' | |
), $atts ) ); | |
if (!is_user_logged_in()) { | |
if($redirect) { | |
$redirect_url = $redirect; | |
} else { | |
$redirect_url = get_permalink(); | |
} | |
$form = wp_login_form(array('echo' => false, 'redirect' => $redirect_url )); | |
} | |
return $form; | |
} | |
add_shortcode('loginform', 'pippin_login_form_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment