WooCommerce Login Form
<?php | |
/** | |
* WooCommerce Login | |
* | |
* Afficher le formulaire de connexion dans votre thème | |
* | |
* @package WooCommerce | |
* @param $text is optionnal. Default text is: 'Se connecter' | |
* @author Grégoire Noyelle | |
* @license GPL-2.0+ | |
* @link http://woocommerce.wp-a2z.org/oik_api/woocommerce_login_form/ | |
*/ | |
// Fonction pour afficher le login WooCommerce dans vos modèles | |
function gn_woocommerce_login_in_template($text = 'Se connecter') { | |
// Si WooCommerce n'est pas actif, on arrête tout | |
if ( ! class_exists( 'WooCommerce' ) ) { | |
return; | |
} | |
// Arguments pour la fonction WooCommerce | |
$args = array( | |
'message' => '<h3 class="login-woo">' . $text . '</h3>' | |
); | |
// Fonction native de WooCommerce | |
woocommerce_login_form($args); | |
} |
<?php | |
function woocommerce_login_form( $args = array() ) { | |
$defaults = array( | |
'message' => '', | |
'redirect' => '', | |
'hidden' => false, | |
); | |
$args = wp_parse_args( $args, $defaults ); | |
wc_get_template( 'global/form-login.php', $args ); | |
} | |
<?php | |
/** | |
* Mon beau thème | |
* | |
* Modèle de page qui ajoute le login après le contenu principal de la page | |
* | |
* Template Name: Connexion Woo | |
* | |
* @package Mon Thème | |
* @author Grégoire Noyelle | |
* @license GPL-2.0+ | |
* @link https://www.gregoirenoyelle.com | |
*/ | |
// Appel de la fonction pour le login WooCommerce | |
// Voir le fichier functions.php | |
// Afficher le login dans entry content | |
add_action('genesis_entry_content', 'gn_add_login_woocommerce_content', 11); | |
function gn_add_login_woocommerce_content() { | |
// Appel de la fonction login maison | |
gntreow_woocommerce_login(); | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment