__('A Section added by hook', 'nhp-opts'), 'desc' => __('

This is a section created by adding a filter to the sections array, great to allow child themes, to add/remove sections from the options.

', 'nhp-opts'), //all the glyphicons are included in the options folder, so you can hook into them, or link to your own custom ones. //You dont have to though, leave it blank for default. 'icon' => trailingslashit(get_template_directory_uri()).'options/img/glyphicons/glyphicons_062_attach.png', //Lets leave this as a blank section, no options just some intro text set above. 'fields' => array() ); return $sections; }//function //add_filter('nhp-opts-sections-twenty_eleven', 'add_another_section'); /* * * Custom function for filtering the args array given by theme, good for child themes to override or add to the args array. * */ function change_framework_args($args){ //$args['dev_mode'] = false; return $args; }//function //add_filter('nhp-opts-args-twenty_eleven', 'change_framework_args'); /* * This is the meat of creating the optons page * * Override some of the default values, uncomment the args and change the values * - no $args are required, but there there to be over ridden if needed. * * */ function setup_framework_options(){ $args = array(); //Set it to dev mode to view the class settings/info in the form - default is false $args['dev_mode'] = true; //google api key MUST BE DEFINED IF YOU WANT TO USE GOOGLE WEBFONTS //$args['google_api_key'] = '***'; //Remove the default stylesheet? make sure you enqueue another one all the page will look whack! //$args['stylesheet_override'] = true; //Add HTML before the form $args['intro_text'] = __('

This is the HTML which can be displayed before the form, it isnt required, but more info is always better. Anything goes in terms of markup here, any HTML.

', 'nhp-opts'); //Setup custom links in the footer for share icons $args['share_icons']['twitter'] = array( 'link' => 'http://twitter.com/lee__mason', 'title' => 'Folow me on Twitter', 'img' => NHP_OPTIONS_URL.'img/glyphicons/glyphicons_322_twitter.png' ); $args['share_icons']['linked_in'] = array( 'link' => 'http://uk.linkedin.com/pub/lee-mason/38/618/bab', 'title' => 'Find me on LinkedIn', 'img' => NHP_OPTIONS_URL.'img/glyphicons/glyphicons_337_linked_in.png' ); //Choose to disable the import/export feature //$args['show_import_export'] = false; //Choose a custom option name for your theme options, the default is the theme name in lowercase with spaces replaced by underscores $args['opt_name'] = 'boloday'; //Custom menu icon //$args['menu_icon'] = ''; //Custom menu title for options page - default is "Options" $args['menu_title'] = __('Theme Options', 'nhp-opts'); //Custom Page Title for options page - default is "Options" $args['page_title'] = __('Boloday Theme Options', 'nhp-opts'); //Custom page slug for options page (wp-admin/themes.php?page=***) - default is "nhp_theme_options" $args['page_slug'] = 'nhp_theme_options'; //Custom page capability - default is set to "manage_options" //$args['page_cap'] = 'manage_options'; //page type - "menu" (adds a top menu section) or "submenu" (adds a submenu) - default is set to "menu" //$args['page_type'] = 'submenu'; //parent menu - default is set to "themes.php" (Appearance) //the list of available parent menus is available here: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters //$args['page_parent'] = 'themes.php'; //custom page location - default 100 - must be unique or will override other items $args['page_position'] = 27; //Custom page icon class (used to override the page icon next to heading) //$args['page_icon'] = 'icon-themes'; //Want to disable the sections showing as a submenu in the admin? uncomment this line //$args['allow_sub_menu'] = false; //Set ANY custom page help tabs - displayed using the new help tab API, show in order of definition $args['help_tabs'][] = array( 'id' => 'nhp-opts-1', 'title' => __('Theme Information 1', 'nhp-opts'), 'content' => __('

This is the tab content, HTML is allowed.

', 'nhp-opts') ); $args['help_tabs'][] = array( 'id' => 'nhp-opts-2', 'title' => __('Theme Information 2', 'nhp-opts'), 'content' => __('

This is the tab content, HTML is allowed.

', 'nhp-opts') ); //Set the Help Sidebar for the options page - no sidebar by default $args['help_sidebar'] = __('

This is the sidebar content, HTML is allowed.

', 'nhp-opts'); $sections = array(); $sections[] = array( 'title' => __('General Settings', 'nhp-opts'), 'desc' => __('

Do some hawt stuff like custom logo and colors and stuff. Pretty Hawt!

', 'nhp-opts'), //all the glyphicons are included in the options folder, so you can hook into them, or link to your own custom ones. //You dont have to though, leave it blank for default. 'icon' => NHP_OPTIONS_URL.'img/glyphicons/glyphicons_062_attach.png', //Lets leave this as a blank section, no options just some intro text set above. 'fields' => array( array( 'id' => '1', 'type' => 'upload', 'title' => 'Logo', 'desc' => 'Upload your Logo', 'std' => get_bloginfo('template_url').'/img/logo.png' ), array( 'id' => '2', 'type' => 'select', 'title' => __('Style', 'nhp-opts'), 'sub_desc' => __('You can choose from a variety of color schemes.', 'nhp-opts'), 'desc' => __('Color schemes change the colors of your blog.', 'nhp-opts'), 'options' => array('style' => 'Default','blue' => 'Blue','orange' => 'Orange', 'dark' => 'Dark', 'green' => 'Green'),//Must provide key => value pairs for select options 'std' => 'style' ), array( 'id' => '3', 'type' => 'select', 'title' => __('Feature Size', 'nhp-opts'), 'sub_desc' => __('Determines the size of the feature (the big images).', 'nhp-opts'), 'desc' => __('Can either span across the whole viewport or be locked to the content width', 'nhp-opts'), 'options' => array('full' => 'Full Width','small' => 'Content Width'),//Must provide key => value pairs for select options 'std' => 'full' ), ) ); $tabs = array(); if (function_exists('wp_get_theme')){ $theme_data = wp_get_theme(); $theme_uri = $theme_data->get('ThemeURI'); $description = $theme_data->get('Description'); $author = $theme_data->get('Author'); $version = $theme_data->get('Version'); $tags = $theme_data->get('Tags'); }else{ $theme_data = get_theme_data(trailingslashit(get_stylesheet_directory()).'style.css'); $theme_uri = $theme_data['URI']; $description = $theme_data['Description']; $author = $theme_data['Author']; $version = $theme_data['Version']; $tags = $theme_data['Tags']; } $theme_info = '
'; $theme_info .= '

'.__('Theme URL: ', 'nhp-opts').''.$theme_uri.'

'; $theme_info .= '

'.__('Author: ', 'nhp-opts').$author.'

'; $theme_info .= '

'.__('Version: ', 'nhp-opts').$version.'

'; $theme_info .= '

'.$description.'

'; $theme_info .= '

'.__('Tags: ', 'nhp-opts').implode(', ', $tags).'

'; $theme_info .= '
'; $tabs['theme_info'] = array( 'icon' => NHP_OPTIONS_URL.'img/glyphicons/glyphicons_195_circle_info.png', 'title' => __('Theme Information', 'nhp-opts'), 'content' => $theme_info ); global $NHP_Options; $NHP_Options = new NHP_Options($sections, $args, $tabs); }//function add_action('init', 'setup_framework_options', 0); /* * * Custom function for the callback referenced above * */ function my_custom_field($field, $value){ print_r($field); print_r($value); }//function /* * * Custom function for the callback validation referenced above * */ function validate_callback_function($field, $value, $existing_value){ $error = false; $value = 'just testing'; /* do your validation if(something){ $value = $value; }elseif(somthing else){ $error = true; $value = $existing_value; $field['msg'] = 'your custom error message'; } */ $return['value'] = $value; if($error == true){ $return['error'] = $field; } return $return; }//function ?>