Last active
September 14, 2018 20:58
-
-
Save gregoirenoyelle/b27c0743c51ac6a3e59907953f20ea1a to your computer and use it in GitHub Desktop.
WooCommerce Login Form
This file contains 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
<?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); | |
} |
This file contains 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
<?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 ); | |
} | |
This file contains 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
<?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