Skip to content

Instantly share code, notes, and snippets.

@hawkidoki
Last active January 4, 2018 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkidoki/1f5255230ca546245aeead7204b6c25c to your computer and use it in GitHub Desktop.
Save hawkidoki/1f5255230ca546245aeead7204b6c25c to your computer and use it in GitHub Desktop.
<?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