Last active
December 23, 2017 17:27
-
-
Save hwkdev/31c544af7fbc78819bc08ff73dbc0fe8 to your computer and use it in GitHub Desktop.
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('init', 'hwk_acf_flexible_content_init'); | |
function hwk_acf_flexible_content_init(){ | |
hwk_acf_flexible_content_generate(array( | |
/** | |
* Contenu Flexible 1 (Simple) | |
* | |
* Filtres additionnels: | |
* group_hwk_contenu_flexible_layouts | |
* group_hwk_contenu_flexible_location | |
*/ | |
array( | |
// group_key pour les filtres | |
'key' => 'group_hwk_contenu_flexible', | |
'title' => 'Contenu Flexible', | |
'fields' => array( | |
array( | |
'key' => 'field_hwk_contenu_flexible', | |
'label' => 'Contenu Flexible', | |
'name' => 'hwk_contenu_flexible', | |
'button_label' => 'Ajouter une section', | |
), | |
), | |
), | |
/** | |
* Contenu Flexible 2 (Layouts & Location pré-enregistrés) | |
* | |
* Filtres additionnels: | |
* group_hwk_contenu_flexible_2_layouts | |
* group_hwk_contenu_flexible_2_location | |
*/ | |
array( | |
// group_key pour les filtres | |
'key' => 'group_hwk_contenu_flexible_2', | |
'title' => 'Contenu Flexible (2)', | |
'fields' => array( | |
array( | |
'key' => 'field_hwk_contenu_flexible_2', | |
'label' => 'Contenu Flexible (2)', | |
'name' => 'hwk_contenu_flexible_2', | |
'button_label' => 'Ajouter une section (2)', | |
// Forcer un layout par défaut | |
'layouts' => array( | |
'field_hwk_layout_mon_layout' => array( | |
'key' => 'field_hwk_layout_mon_layout', | |
'name' => 'hwk_layout_mon_layout', | |
'label' => 'Mon Layout', | |
'display' => 'block', // block | row | table | |
'sub_fields' => array( | |
array( | |
'key' => 'field_hwk_layout_mon_layout_clone', | |
'label' => '', | |
'name' => 'hwk_layout_mon_layout', | |
'type' => 'clone', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array( | |
'width' => '', | |
'class' => '', | |
'id' => '' | |
), | |
'hide_admin' => 0, | |
'clone' => array( | |
0 => 'group_5a365d05760bb', | |
), | |
'display' => 'group', | |
'layout' => 'block', | |
'prefix_label' => 0, | |
'prefix_name' => 1 | |
) | |
), | |
'min' => '', | |
'max' => '' | |
) | |
), | |
), | |
), | |
// Forcer une location par défaut | |
'location' => array( | |
array( | |
array( | |
'param' => 'post_type', | |
'operator' => '==', | |
'value' => 'post' | |
), | |
), | |
), | |
), | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment