<?php $opt = new OptionsPage(array(wp_option::factory('text', 'twitter_username'))); $opt->title = 'Other options'; $opt->file = basename(__FILE__); $opt->parent = "theme-options.php"; $opt->attach_to_wp();
$bg_color->set_default_value($default_bg_color); $bg_color->help_text("Default color: {$default_bg_color}"); $colorset1 = new color_scheme('Default Scheme'); $colorset1->add_colors(array('3a2820', 'd45023', 'ffffff')); $colorset2 = new color_scheme('Dark Scheme'); $colorset2->add_colors(array('000000', 'eab035', 'ffffff')); $colorset3 = new color_scheme('Red Scheme'); $colorset3->add_colors(array('350505', '151515', 'ffffff')); $color_scheme = wp_option::factory('choose_color_scheme', 'choco_color_scheme', 'Color Scheme'); $color_scheme->add_color_schemes(array($colorset1, $colorset2, $colorset3)); $color_scheme->set_default_value('Default Scheme'); $bg_image = wp_option::factory('image', 'background_image', 'Background Image'); $bg_repeat = wp_option::factory('select', 'background_repeat', 'Background Repeat'); $bg_repeat->add_options(array('no-repeat' => 'No Repeat', 'repeat-x' => 'Repeat Horizontal(repeat-x)', 'repeat-y' => 'Repeat Vertical(repeat-y)', 'repeat' => 'Repeat Horizontal and Vertical(repeat)')); $bg_repeat->set_default_value('no'); $inner_options = new OptionsPage(array(wp_option::factory('separator', 'theme'), $color_scheme, wp_option::factory('separator', 'background'), $bg_color, $bg_image, $bg_repeat, wp_option::factory('separator', 'scripts'), wp_option::factory('header_scripts', 'header_script'), wp_option::factory('footer_scripts', 'footer_script'))); $inner_options->title = 'General'; $inner_options->file = basename(__FILE__); $inner_options->parent = "theme-options.php"; $inner_options->attach_to_wp(); function print_color_scheme_background_changer_js() { ?> <script type="text/javascript" charset="utf-8"> function rgb_to_hex(r, g, b) { return to_hex(r) + to_hex(g) + to_hex(b); } function to_hex(N) { if (N==null) return "00"; N = parseInt(N);
$(this).parents('tr:eq(0)').nextAll('tr[class^=wp_option_choose_]').hide(); $(this).parents('tr:eq(0)').nextAll('tr.wp_option_choose_' + $(this).val()).show(); if ($(this).val()=='pages') { $('.field-enable_dropdown, .field-dropdown_depth').show(); } else { $('.field-enable_dropdown, .field-dropdown_depth').hide(); } }).change(); }); </script> <?php } add_action('admin_footer', 'print_nav_type_js'); $nav_type_pages = wp_option::factory('choose_pages', 'header_nav_pages_exclude', 'Exclude Pages'); $nav_type_pages->help_text('The "Page Order" section on the Page > Add New administration panel allows you to reorder pages'); $nav_type_pages->hide(); $nav_type_categories = wp_option::factory('choose_categories', 'header_nav_categories_exclude', 'Exclude Categories'); $nav_type_categories->hide(); $enable_dropdown = wp_option::factory('select', 'enable_dropdown', 'Enable dropdown navigation'); $enable_dropdown->add_options(array('yes' => 'Yes', 'no' => 'No')); $enable_dropdown->set_default_value('yes'); $dropdown_depth = wp_option::factory('select', 'dropdown_depth', 'Max dropdown levels'); $depth_range = range(1, 5); $dropdown_depth->add_options(array_combine($depth_range, $depth_range)); $dropdown_depth->set_default_value(2); $opt = new OptionsPage(array($navigation_type, $nav_type_pages, $nav_type_categories, $enable_dropdown, $dropdown_depth)); $opt->title = 'Navigation'; $opt->file = basename(__FILE__); $opt->parent = "theme-options.php"; $opt->attach_to_wp();
<?php function attach_main_options_page() { $title = "Theme Options"; add_menu_page($title, $title, 'edit_themes', basename(__FILE__), create_function('', '')); } add_action('admin_menu', 'attach_main_options_page'); $inner_options = new OptionsPage(array(wp_option::factory('text', 'header_text')->set_default_value('Hello. Welcome to cubetech! <br />Feel free to check out our work or so.'), wp_option::factory('text', 'default_header_title')->set_default_value('Default header title'), wp_option::factory('text', 'default_header_description')->set_default_value('Default Description'), wp_option::factory('text', 'facebook_link')->set_default_value('http://www.facebook.com'), wp_option::factory('text', 'twitter_link')->set_default_value('http://www.twitter.com'), wp_option::factory('text', 'googleplus_link')->set_default_value('http://www.google.com/+'), wp_option::factory('text', 'copyright')->set_default_value('(c) ' . date('Y') . ' Allright reservred'), wp_option::factory('header_scripts', 'header_script'), wp_option::factory('footer_scripts', 'footer_script'))); $inner_options->title = 'General'; $inner_options->file = basename(__FILE__); $inner_options->parent = "theme-options.php"; $inner_options->attach_to_wp();