Last active
January 4, 2018 22:53
-
-
Save hwkdev/1f5255230ca546245aeead7204b6c25c 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('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; | |
acf_render_field_wrap(array( | |
'label' => __('Texte','acf'), | |
'instructions' => __('Instructions','acf'), | |
'type' => 'text', | |
'name' => 'hwk_text', | |
'prefix' => 'acf_field_group', | |
'value' => (isset($group['hwk_text'])) ? $group['hwk_text'] : '', | |
'placeholder' => 'placeholder', | |
'prepend' => 'prefixe', | |
'append' => 'suffixe', | |
'maxlength' => 2 | |
)); | |
// ... | |
?> | |
<script type="text/javascript"> | |
if(typeof acf !== 'undefined'){ | |
acf.postbox.render({ | |
'id': 'acf-field-group-options-plus', | |
'label': 'left' | |
}); | |
} | |
</script> | |
<?php | |
}, 'acf-field-group', 'normal', 'high'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment