- Créer un groupe de champs ACF et activer l'option "Multi-étapes"
- Créer des champs de type "Groupe" et les remplir des sous-champs nécessaires. Chaque champ "Groupe" sera une étape à part entière dans le formulaire.
- Insérer le formulaire front-end avec acf_form en ajoutant les 2 champs de types hidden (acf_multisteps_form & acf_multistep_current_step).
- Enjoy !
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 | |
/** | |
* Affiche le code postal et la ville sur 2 colonnes | |
* Exemple : http://media.mosaika.fr/mbyK | |
*/ | |
function msk_display_zip_city_in_columns($fields) { | |
$fields['postcode']['class'] = array('address-field', 'form-row-first'); | |
$fields['city']['class'] = array('address-field', 'form-row-last'); | |
return $fields; |
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 | |
/** | |
* Cacher/supprimer le champ "Notes" sur la page Commande de WooCommerce | |
*/ | |
add_filter('woocommerce_enable_order_notes_field', '__return_false'); |
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 | |
/** | |
* Changer le logo PayPal afficher sur la page Commande du tunnel d'achat WooCommerce | |
* Ici, on affiche l'image nouveau-paypal-logo.png stockée dans le dossier /images/ du thème WordPress en cours d'utilisation | |
*/ | |
function msk_change_paypal_logo() { | |
return get_template_directory_uri() . '/images/nouveau-paypal-logo.png'; | |
} | |
add_filter('woocommerce_paypal_icon', 'msk_change_paypal_logo'); |
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 | |
/** | |
* Ne plus rendre le champ "Téléphone" obligatoire sur la page Commande de WooCommerce | |
*/ | |
function msk_wc_make_phone_field_not_required($address_fields, $country) { | |
$address_fields['billing_phone']['required'] = false; | |
return $address_fields; | |
} |
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 | |
/*** | |
* Rediriger la page Panier directement vers la page Commande dans WooCommerce | |
*/ | |
function msk_wc_redirect_cart_to_checkout() { | |
if (is_cart() && !WC()->cart->is_empty()) { | |
wp_redirect(wc_get_checkout_url()); | |
exit; | |
} |
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 | |
/** | |
* Trouver les IDs des admins d'un site WordPress | |
*/ | |
function msk_get_admins_ids($amount = 9999) { | |
global $wpdb; | |
$admins_ids = $wpdb->get_col( | |
$wpdb->prepare( |
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 | |
// Article/tutoriel complet sur https://mosaika.fr/astuces-developpement-acf/ | |
// Documentation officielle https://www.advancedcustomfields.com/resources/local-json/ | |
define('MSK_ACF_PATH', plugin_dir_path(__FILE__)); | |
/** | |
* Enregistrer la config de ses metaboxes & champs ACF dans un dossier de son plugin/thème | |
* Filtre : acf/settings/save_json |
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 | |
// Article/tutoriel complet sur https://mosaika.fr/astuces-developpement-acf/ | |
// Documentation officielle https://www.advancedcustomfields.com/resources/acf-load_field/ | |
/** | |
* Désactiver un champ (lecture seule) | |
* Filtre : acf/load_field | |
*/ |
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 | |
// Article/tutoriel complet sur https://mosaika.fr/astuces-developpement-acf/ | |
// Documentation officielle https://www.advancedcustomfields.com/resources/acf-load_field/ | |
/** | |
* Charger dynamiquement les choix d'un menu déroulant | |
* Filtre : acf/load_field | |
*/ |