Deprecated: Assigning the return value of new by reference is deprecated in /home/summarg/domains/summarg.com/public_html/wp-content/plugins/post-series/post-series.php on line 841 Notice: is_feed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) in /home/summarg/domains/summarg.com/public_html/wp-includes/functions.php on line 3245 Colocar formulario de login a WordPress mediante shortcodes | SummArg

SummArg | Cursos y recursos para webmasters

22/10/2011

Colocar formulario de login a WordPress mediante shortcodes

Para poder colocar en entradas y páginas un formulario de login a WordPress puede resultar muy cómodo el uso de shortcodes, que se definen desde el archivo functions.php de nuestro theme. Para ello devpress comparte este excelente snippet.

function devpress_login_form_shortcode() {
if ( is_user_logged_in() )
return '';

return wp_login_form( array( 'echo' => false ) );
}

function devpress_add_shortcodes() {
add_shortcode( 'devpress-login-form', 'devpress_login_form_shortcode' );
}

add_action( 'init', 'devpress_add_shortcodes' );

Ahora en cualquier entrada bastará con utilizar el shorcode para que aparezca el formulario.

[devpress-login-form]

Dejar un comentario

Notice: Undefined variable: wp_sh_class_name in /home/summarg/domains/summarg.com/public_html/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1002 Notice: Undefined variable: wp_sh_class_name in /home/summarg/domains/summarg.com/public_html/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1002 Notice: Use of undefined constant XML - assumed 'XML' in /home/summarg/domains/summarg.com/public_html/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048