Created
January 5, 2019 09:49
-
-
Save Tsunamijaan/38a08a8d8d3c58a192209342ca9b4c4e to your computer and use it in GitHub Desktop.
Option tree demo theme option
This file contains 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( 'admin_init', 'my_theme_custom_theme_options', 1 ); | |
function my_theme_custom_theme_options() { | |
$saved_settings = get_option( 'option_tree_settings', array() ); | |
$custom_settings = array( | |
'contextual_help' => array( | |
'content' => array( | |
array( | |
'id' => 'general_help', | |
'title' => 'General', | |
'content' => '<p>Help content goes here!</p>' | |
) | |
), | |
'sidebar' => '<p>Sidebar content goes here!</p>' | |
), | |
'sections' => array( | |
array( | |
'title' => 'General', | |
'id' => 'general_default' | |
) | |
), | |
'settings' => array( | |
array( | |
'label' => 'News page Banner', | |
'id' => 'news_page_banner', | |
'type' => 'upload', | |
'section' => 'general_default' | |
) | |
) | |
); | |
$custom_settings = apply_filters( 'option_tree_settings_args', $custom_settings ); | |
if ( $saved_settings !== $custom_settings ) { | |
update_option( 'option_tree_settings', $custom_settings ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment