Last active
December 3, 2022 07:32
-
-
Save vishalkakadiya/5c27f3c71134f2802d430a98e737c227 to your computer and use it in GitHub Desktop.
FieldManager - Add custom settings page with vertical tabs.
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 settings_fields() { | |
$children['tab'] = new Fieldmanager_Group( array( | |
'label' => 'ABCD', // This name must match what we registered in `fm_register_submenu_page()` | |
'children' => array( | |
'text' => new Fieldmanager_Textfield( 'Text Field' ), | |
'autocomplete' => new Fieldmanager_Autocomplete( 'Autocomplete', array( 'datasource' => new Fieldmanager_Datasource_Post() ) ), | |
'textarea' => new Fieldmanager_TextArea( 'TextArea' ), | |
'media' => new Fieldmanager_Media( 'Media File' ), | |
'checkbox' => new Fieldmanager_Checkbox( 'Checkbox' ), | |
'radios' => new Fieldmanager_Radios( 'Radio Buttons', array( | |
'options' => array( | |
'One', | |
'Two', | |
'Three' | |
) | |
) ), | |
'select' => new Fieldmanager_Select( 'Select Dropdown', array( | |
'options' => array( | |
'One', | |
'Two', | |
'Three' | |
) | |
) ), | |
'richtextarea' => new Fieldmanager_RichTextArea( 'Rich Text Area' ), | |
), | |
) ); | |
$fm = new Fieldmanager_Group( array( | |
'name' => 'global_curation', | |
'tabbed' => 'vertical', | |
'children' => $children, | |
) ); | |
$fm->activate_submenu_page(); | |
} | |
add_action( 'fm_submenu_global_curation', 'settings_fields', 12 ); | |
fm_register_submenu_page( 'global_curation', 'curation', __( 'Global Curation', 'text-domain' ) ); | |
function your_admin_menu() { | |
add_menu_page( __( 'Curation', 'text-domain' ), __( 'Curation', 'text-domain' ), 'edit_posts', 'curation', '__return_false', 'dashicons-randomize', '4.1' ); | |
} | |
add_action( 'admin_menu', 'your_admin_menu' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice