gppro_sections
When using the gppro_admin_block_add
filter, you need to also add the corresponding sections to complete the process. The section can contain any number of options related to your new block. The slug
variable in the admin block must match the array key set up in the section itself.
The section is a multi-dimensional array:
title:
(string) The title above each option groupdata:
(array) An array of each option, using a key => value setup. the array key must be unique.label:
(string) the label for the optionsub:
(string) optional small text to clarify a section (i.e. a hover state)input:
(string) available input type. a list of available types are here, or a custom input type can be declared with a corresponding callbacktarget:
(string) which CSS class to target the changes in the live previewselector:
(string) what CSS selector to use in the live previewtip:
(string) optional tooltipcallback:
(string) if declaring a custom input type, the function name used here will be called
Adding a new section corresponding to a new admin block.
function my_cool_section( $sections, $class ) { $sections['cool_thing'] = array( array( 'title' => 'Section Title', 'data' => array( 'new-option' => array( 'label' => __( 'New Option', 'my-text-domain' ), 'sub' => __( 'Extra', 'my-text-domain' ), 'input' => 'color', 'target' => $class.' .class-to-target', 'selector' => 'background-color' 'tip' => __( 'Tooltip info', 'my-text-domain' ), ), 'custom-option' => array( 'label' => __( 'Custom Option', 'my-text-domain' ), 'input' => 'custom', 'callback' => 'callback_function_name' ), ), ), ); return $sections; } add_filter ( 'gppro_sections', 'my_cool_section', 10, 2 );