This file contains hidden or 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 | |
| $current_user = wp_get_current_user(); | |
| acf_enqueue_scripts(); | |
| get_header(); | |
| ?> | |
| <?php if(have_posts()): ?> | |
| <?php while(have_posts()): the_post(); ?> | |
| <div class="col-md-12"> |
This file contains hidden or 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
| /** | |
| * ACF Form: Prevent default form submit | |
| */ | |
| jQuery(document).on('submit', '.acf-form', function(e) { | |
| e.preventDefault(); | |
| }); | |
| /** | |
| * ACF Form: Init | |
| */ |
This file contains hidden or 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
| .acf-form.acf-form-ajax .acf-error-message{ | |
| display:none; | |
| } | |
| .acf-form.acf-form-ajax .error.text-danger.small p{ | |
| margin:0; | |
| margin-top:5px; | |
| } | |
| .acf-form.acf-form-ajax [data-name="remember_me"] ul{ |
This file contains hidden or 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 | |
| add_action('template_redirect', 'hwk_acf_form_redirect'); | |
| function hwk_acf_form_redirect(){ | |
| // Logged in | |
| if(is_user_logged_in() && (is_page('connexion') || is_page('mot-de-passe-oublie') || is_page('inscription'))) | |
| wp_redirect(home_url('mon-compte')); | |
| // Not logged in |
This file contains hidden or 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 | |
| /** | |
| * ACF Form Account: Register Form | |
| */ | |
| acf_register_form(array( | |
| 'id' => 'hwk_ajax_acf_account', | |
| 'post_id' => 'hwk_ajax_acf_account', | |
| 'form_attributes' => array( | |
| 'class' => 'acf-form acf-form-ajax', |
This file contains hidden or 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
| [ | |
| { | |
| "key": "group_5aacfcf20773c", | |
| "title": "Connexion", | |
| "fields": [ | |
| { | |
| "key": "field_5aacfcf6b09b7", | |
| "label": "Login", | |
| "name": "login", | |
| "type": "text", |
This file contains hidden or 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 | |
| add_action('wp_ajax_hwk_ajax_template', 'hwk_ajax_template'); | |
| add_action('wp_ajax_nopriv_hwk_ajax_template', 'hwk_ajax_template'); | |
| function hwk_ajax_template($id = false){ | |
| $configs = apply_filters('hwk_ajax_configs', $configs); | |
| if(empty($configs)) | |
| return; | |
| $html = hwk_ajax_config($configs, $id); |
This file contains hidden or 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 | |
| add_filter('hwk_ajax_configs', 'hwk_ajax_declare_config'); | |
| function hwk_ajax_declare_config($config){ | |
| $config[] = array( | |
| 'id' => 'hwk_ajax_heavy_query', // L'ID de référence de la configuration | |
| 'template' => 'templates/modules/module-heavy', // Path d'affichage du fichier qui effectue le traitement lourd | |
| 'cache' => 'templates/modules/cache/module-heavy', // path du fichier du cache HTML | |
| 'interval' => 900, // Intervalle de mise à jour du module | |
| 'flush' => get_the_ID(), // Flush du cache global à chaque intervalle? true|false|post_id |
This file contains hidden or 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
| jQuery(document).ready(function($){ | |
| // Vérification si un container de module existe | |
| if($('[data-hwk-ajax-action-id]').length){ | |
| // Traiter chaque module indépendamment | |
| $('[data-hwk-ajax-action-id]').each(function(){ | |
| // Variables générales | |
| var $this = $(this), |
This file contains hidden or 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 | |
| // Vérification que notre fichier est bien appelé via notre système | |
| if(!$args = get_query_var('hwk_ajax_data')) | |
| return; | |
| // Data disponible: | |
| // $args['id'] | |
| // $args['template'] | |
| // $args['cache'] |