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('acf/render_field_group_settings', '_hwk_flexible_add_group_option', 10, 1); | |
function _hwk_flexible_add_group_option($group){ | |
acf_render_field_wrap(array( | |
'label' => __('Ajouter au contenu flexible', 'acf'), | |
'instructions' => __('Dossier de template par défaut', 'acf'), | |
'type' => 'checkbox', | |
'name' => 'hwk_flexible_content', | |
'prefix' => 'acf_field_group', | |
'value' => ((isset($group['hwk_flexible_content'])) ? 1 : 0), |
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('acf/render_field_group_settings', 'hwk_acf_field_groups_add_settings', 10); | |
function hwk_acf_field_groups_add_settings($group){ | |
/**************** | |
* Basic | |
****************/ | |
// Text | |
// Return: "hwk_text": "foo bar" | |
acf_render_field_wrap(array( |
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('acf/render_field_group_settings', 'hwk_acf_field_groups_add_settings_fa', 10); | |
function hwk_acf_field_groups_add_settings_fa($group){ | |
// Font Awesome | |
// Return: "hwk_fontawesome": "fa-500px" | |
acf_render_field_wrap(array( | |
'label' => __('Font Awesome','acf'), | |
'instructions' => __('Instructions','acf'), | |
'type' => 'font-awesome', | |
'name' => 'hwk_fontawesome', |
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('acf/field_group/admin_head', 'hwk_acf_field_groups_add_metabox'); | |
function hwk_acf_field_groups_add_metabox(){ | |
add_meta_box('acf-field-group-options-plus', __('Options supplémentaires', 'acf'), function(){ | |
global $field_group; | |
if(!acf_is_field_group_key( $field_group['key'])) | |
$field_group['key'] = uniqid('group_'); | |
$group = $field_group; |
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('acf/render_field_group_settings', 'hwk_acf_field_groups_add_settings_tabs', 10); | |
function hwk_acf_field_groups_add_settings_tabs($group){ | |
// Tab | |
acf_render_field_wrap(array( | |
'label' => __('Basic','acf'), | |
'type' => 'tab', | |
'name' => 'hwk_tab_basic', | |
'key' => 'hwk_tab_basic', | |
'prefix' => 'acf_field_group', |
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 | |
function hwk_acf_get_group_by_field($field, $post_id = null){ | |
if(!$post_id) | |
$post_id = get_the_ID(); | |
if(!$post_id) | |
$post_id = get_queried_object_id(); | |
if( ($field = get_field_object($field, $post_id)) && isset($field['parent']) && ($group = acf_get_field_group($field['parent'])) ) | |
return $group; |
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
Array | |
( | |
[ID] => 0 | |
[key] => group_5a365d05760bb | |
[title] => Mon Groupe | |
[fields] => Array | |
( | |
) | |
[location] => Array |
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 |
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 | |
if(!function_exists('wp_parse_args_recursive')){ | |
function wp_parse_args_recursive($args, $default, $preserve_integer_keys = true){ | |
if (!is_array($default) && !is_object($default)) | |
return wp_parse_args($args, $default); | |
$is_object = ( is_object($args) || is_object($default) ); | |
$output = array(); | |
foreach(array($default, $args) as $elements){ |
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_5a3e6acab7fd0", | |
"title": "Mon Groupe", | |
"fields": false, | |
"location": [ | |
[ | |
{ | |
"param": "post_type", | |
"operator": "==", | |
"value": "post" |
OlderNewer