Skip to content

Instantly share code, notes, and snippets.

@RiodeJaneiroo
Created December 7, 2019 13:29
Show Gist options
  • Save RiodeJaneiroo/2048787aa06cb3b1f910c8bda7e0b9a0 to your computer and use it in GitHub Desktop.
Save RiodeJaneiroo/2048787aa06cb3b1f910c8bda7e0b9a0 to your computer and use it in GitHub Desktop.
[acf sub page - scripts] #wordpress
$acfParent = acf_add_options_page(array(
'page_title' => 'Основные настройки темы',
'menu_title' => 'Настройка темы',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
$acfChild = acf_add_options_sub_page(array(
'page_title' => 'Скрипты',
'menu_title' => 'Скрипты',
'parent_slug' => $acfParent['menu_slug'],
));
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5deba77b061de',
'title' => 'Скрипты',
'fields' => array(
array(
'key' => 'field_5deba782e20e1',
'label' => 'Код в <head>',
'name' => 'code_head',
'type' => 'textarea',
'required' => 0,
'conditional_logic' => 0,
'rows' => 10,
),
array(
'key' => 'field_5deba812e20e2',
'label' => 'Код перед открывающим тегом <body>',
'name' => 'code_body',
'type' => 'textarea',
'required' => 0,
'conditional_logic' => 0,
'rows' => 10,
),
array(
'key' => 'field_5deba830e20e3',
'label' => 'Код перед закрывающим тегом </body>',
'name' => 'code_footer',
'type' => 'textarea',
'required' => 0,
'conditional_logic' => 0,
'rows' => 10,
),
),
'location' => array(
array(
array(
'param' => 'options_page',
'operator' => '==',
'value' => 'acf-options-skripty',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
));
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment