Advertisement
Guest User

Untitled

a guest
Jul 11th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. // add this to your functions file
  2. add_shortcode('shortcode_name_here', 'my_login_form_shortcode');
  3. function my_login_form_shortcode( $attr ) {
  4.  
  5. if ( is_user_logged_in() )
  6. return '';
  7.  
  8. /* Set up some defaults. */
  9. $defaults = array(
  10. 'label_username' => 'Username',
  11. 'label_password' => 'Password'
  12. );
  13.  
  14. /* Merge the user input arguments with the defaults. */
  15. $attr = shortcode_atts( $defaults, $attr );
  16. /* Set 'echo' to 'false' because we want it to always return instead of print for shortcodes. */
  17. $attr['echo'] = false;
  18.  
  19. return wp_login_form( $attr );
  20. }
  21.  
  22. // use this in your template
  23. echo do_shortcode('[shortcode_name_here label_username="Gebruikersnaam" label_password="Wachtwoord"]');
  24. // use this in your wordpress editor
  25. [shortcode_name_here label_username="Gebruikersnaam" label_password="Wachtwoord"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement