__( $menu_title, 'wpthemeseo'), 'menu_title' => __($menu_title, 'wpthemeseo'), 'capability' => 'edit_theme_options', 'menu_slug' => 'wpthemeseo-options-framework', 'callback' => 'wpthemeseo_page' ); return apply_filters( 'wpthemeseo_menu', $menu ); } function wpthemeseo_add_page() { $menu = wpthemeseo_menu_settings(); $ws_page = add_theme_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['callback'] ); add_action( 'admin_enqueue_scripts', 'wpthemeseo_load_scripts' ); add_action( 'admin_print_styles-' . $ws_page, 'wpthemeseo_load_styles' ); } function wpthemeseo_load_styles() { wp_enqueue_style( 'wpthemeseo', OPTIONS_FRAMEWORK_URL.'css/wpthemeseo.css' ); if ( !wp_style_is( 'wp-color-picker','registered' ) ) { wp_register_style('wp-color-picker', OPTIONS_FRAMEWORK_URL.'css/color-picker.min.css'); } wp_enqueue_style( 'wp-color-picker' ); } function wpthemeseo_load_scripts( $hook ) { $menu = wpthemeseo_menu_settings(); if ( 'appearance_page_' . $menu['menu_slug'] != $hook ) return; if ( !wp_script_is( 'wp-color-picker', 'registered' ) ) { wp_register_script( 'iris', OPTIONS_FRAMEWORK_URL . 'js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); wp_register_script( 'wp-color-picker', OPTIONS_FRAMEWORK_URL . 'js/color-picker.min.js', array( 'jquery', 'iris' ) ); $colorpicker_l10n = array( 'clear' => __( 'Clear' ), 'defaultString' => __( 'Default' ), 'pick' => __( 'Select Color' ) ); wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n ); } wp_enqueue_script( 'options-custom', OPTIONS_FRAMEWORK_URL . 'js/options-custom.js', array( 'jquery','wp-color-picker' ) ); add_action( 'admin_head', 'ws_admin_head' ); } function ws_admin_head() { do_action( 'wpthemeseo_custom_scripts' ); } if ( !function_exists( 'wpthemeseo_page' ) ) : function wpthemeseo_page() { settings_errors(); ?>
* add_filter('ws_options', function($options) {
* $options[] = array(
* 'name' => 'Input Text Mini',
* 'desc' => 'A mini text input field.',
* 'id' => 'example_text_mini',
* 'std' => 'Default',
* 'class' => 'mini',
* 'type' => 'text'
* );
*
* return $options;
* });
*
*
* Also allows for setting options via a return statement in the
* options.php file. For example (in options.php):
*
*
* return array(...);
*
*
* @return array (by reference)
*/
function &_wpthemeseo_options() {
static $options = null;
if ( !$options ) {
// Load options from options.php file (if it exists)
if ( $optionsfile = WPTHEMESEO_PATH .'options.php' ) {
$maybe_options = require_once $optionsfile;
if (is_array($maybe_options)) {
$options = $maybe_options;
} else if ( function_exists( 'wpthemeseo_options' ) ) {
$options = wpthemeseo_options();
}
}
// Allow setting/manipulating options via filters
$options = apply_filters('ws_options', $options);
}
return $options;
}