本文整理汇总了PHP中optionsframework_options函数的典型用法代码示例。如果您正苦于以下问题:PHP optionsframework_options函数的具体用法?PHP optionsframework_options怎么用?PHP optionsframework_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionsframework_options函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: options_theme_customizer_register
function options_theme_customizer_register($wp_customize)
{
/**
* This is optional, but if you want to reuse some of the defaults
* or values you already have built in the options panel, you
* can load them into $options for easy reference
*/
$options = optionsframework_options();
/* Basic */
$wp_customize->add_section('options_theme_customizer_basic', array('title' => __('Basic', 'options_theme_customizer'), 'priority' => 100));
$wp_customize->add_setting('options_theme_customizer[example_text]', array('default' => $options['example_text']['std'], 'type' => 'option'));
$wp_customize->add_control('options_theme_customizer_example_text', array('label' => $options['example_text']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_text]', 'type' => $options['example_text']['type']));
$wp_customize->add_setting('options_theme_customizer[example_select]', array('default' => $options['example_select']['std'], 'type' => 'option'));
$wp_customize->add_control('options_theme_customizer_example_select', array('label' => $options['example_select']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_select]', 'type' => $options['example_select']['type'], 'choices' => $options['example_select']['options']));
$wp_customize->add_setting('options_theme_customizer[example_radio]', array('default' => $options['example_radio']['std'], 'type' => 'option'));
$wp_customize->add_control('options_theme_customizer_example_radio', array('label' => $options['example_radio']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_radio]', 'type' => $options['example_radio']['type'], 'choices' => $options['example_radio']['options']));
$wp_customize->add_setting('options_theme_customizer[example_checkbox]', array('default' => $options['example_checkbox']['std'], 'type' => 'option'));
$wp_customize->add_control('options_theme_customizer_example_checkbox', array('label' => $options['example_checkbox']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_checkbox]', 'type' => $options['example_checkbox']['type']));
/* Extended */
$wp_customize->add_section('options_theme_customizer_extended', array('title' => __('Extended', 'options_theme_customizer'), 'priority' => 110));
$wp_customize->add_setting('options_theme_customizer[example_uploader]', array('type' => 'option'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'example_uploader', array('label' => $options['example_uploader']['name'], 'section' => 'options_theme_customizer_extended', 'settings' => 'options_theme_customizer[example_uploader]')));
$wp_customize->add_setting('options_theme_customizer[example_colorpicker]', array('default' => $options['example_colorpicker']['std'], 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => $options['example_colorpicker']['name'], 'section' => 'options_theme_customizer_extended', 'settings' => 'options_theme_customizer[example_colorpicker]')));
}
开发者ID:brainverb,项目名称:options-framework-plugin,代码行数:25,代码来源:options.php
示例2: mdl_get_option
function mdl_get_option($name, $default = false)
{
$name = 'mdl_' . $name;
if (false === $default) {
$options = optionsframework_options();
foreach ($options as $option) {
if (isset($option['id']) && $option['id'] == $name) {
$default = isset($option['std']) ? $option['std'] : false;
break;
}
}
}
return of_get_option($name, $default);
}
开发者ID:jcglp,项目名称:wptheme-modelo,代码行数:14,代码来源:general.php
示例3: optionsframework_tabs
/**
* Generates the tabs that are used in the options menu
*/
function optionsframework_tabs() {
$counter = 0;
$options = optionsframework_options();
$menu = '';
foreach ( $options as $value ) {
// Heading for Navigation
if ( $value['type'] == "heading" ) {
$counter++;
$class = '';
$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
$class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
$menu .= '<a id="options-group-'. $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'. $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
}
}
return $menu;
}
开发者ID:erudith,项目名称:fullpower,代码行数:22,代码来源:options-interface.php
示例4: options_theme_customizer_register
function options_theme_customizer_register($wp_customize)
{
/**
* This is optional, but if you want to reuse some of the defaults
* or values you already have built in the options panel, you
* can load them into $options for easy reference
*/
$options = optionsframework_options();
$optionsframework_settings = get_option('optionsframework');
$option_name = $optionsframework_settings['id'];
/* Basic */
$wp_customize->add_section('options_theme_customizer_theme_fonts', array('title' => __('Theme Fonts', LANGUAGE_ZONE), 'priority' => 100));
/* Font Family */
$wp_customize->add_setting($option_name . '[fonts-font_family]', array('default' => $options['fonts-font_family']['std'], 'type' => 'option'));
$wp_customize->add_control($option_name . '_fonts-font_family', array('label' => $options['fonts-font_family']['desc'], 'section' => 'options_theme_customizer_theme_fonts', 'settings' => $option_name . '[fonts-font_family]', 'type' => 'select', 'choices' => $options['fonts-font_family']['options']));
/* Web Fonts */
$wp_customize->add_setting($option_name . '[fonts-list]', array('default' => $options['fonts-list']['std'], 'type' => 'option'));
$wp_customize->add_control($option_name . '_fonts-list', array('label' => $options['fonts-list']['desc'], 'section' => 'options_theme_customizer_theme_fonts', 'settings' => $option_name . '[fonts-list]', 'type' => 'select', 'choices' => $options['fonts-list']['options']));
}
开发者ID:mnjit,项目名称:aa-global,代码行数:19,代码来源:init.php
示例5: apply_filters
/**
* Wrapper for optionsframework_options()
*
* Allows for manipulating or setting options via 'of_options' filter
* For example:
*
* <code>
* add_filter( 'of_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;
* });
* </code>
*
* Also allows for setting options via a return statement in the
* options.php file. For example (in options.php):
*
* <code>
* return array(...);
* </code>
*
* @return array (by reference)
*/
static function &_optionsframework_options()
{
static $options = null;
if (!$options) {
// Load options from options.php file (if it exists)
$location = apply_filters('options_framework_location', array('admin/options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = (require_once $optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
// Allow setting/manipulating options via filters
$options = apply_filters('of_options', $options);
}
return $options;
}
开发者ID:bunnywong,项目名称:freshlinker,代码行数:51,代码来源:class-options-framework.php
示例6: optionsframework_defaults
/**
* Get Default Options For Option Framework
*/
function optionsframework_defaults()
{
$options = null;
$location = apply_filters('options_framework_location', array(get_template_directory() . '/inc/theme/options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = tokopress_require_file($optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
$options = apply_filters('of_options', $options);
$defaults = array();
foreach ($options as $key => $value) {
if (isset($value['id']) && isset($value['std'])) {
$defaults[$value['id']] = $value['std'];
}
}
return $defaults;
}
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:26,代码来源:options.php
示例7: optionsframework_fields
/**
* Generates the options fields that are used in the form.
*/
function optionsframework_fields()
{
global $allowedtags;
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
} else {
$option_name = 'optionsframework';
}
$settings = get_option($option_name);
$options = optionsframework_options();
$counter = 0;
$menu = '';
$output = '';
foreach ($options as $value) {
$counter++;
$val = '';
$select_value = '';
$checked = '';
// Wrap all options
if ($value['type'] != "heading" && $value['type'] != "info") {
// Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/\\W/', '', strtolower($value['id']));
$id = 'section-' . $value['id'];
$class = 'section ';
if (isset($value['type'])) {
$class .= ' section-' . $value['type'];
}
if (isset($value['class'])) {
$class .= ' ' . $value['class'];
}
$output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
$output .= '<h3 class="heading"> ' . esc_html($value['name']) . '</h3>' . "\n";
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
}
// Set default value to $val
if (isset($value['std'])) {
$val = $value['std'];
}
// If the option is already saved, ovveride $val
if ($value['type'] != 'heading' && $value['type'] != 'info') {
if (isset($settings[$value['id']])) {
$val = $settings[$value['id']];
// Striping slashes of non-array options
if (!is_array($val)) {
$val = stripslashes($val);
}
}
}
switch ($value['type']) {
// Basic text input
case 'text':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Textarea
// Textarea
case 'textarea':
$cols = '8';
$ta_value = '';
if (isset($value['options'])) {
$ta_options = $value['options'];
if (isset($ta_options['cols'])) {
$cols = $ta_options['cols'];
} else {
$cols = '8';
}
}
$val = stripslashes($val);
$output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
break;
// Select Box
// Select Box
case $value['type'] == 'select':
$output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
foreach ($value['options'] as $key => $option) {
$selected = '';
if ($val != '') {
if ($val == $key) {
$selected = ' selected="selected"';
}
}
$output .= '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
}
$output .= '</select>';
break;
// Radio Box
// Radio Box
case "radio":
$name = $option_name . '[' . $value['id'] . ']';
foreach ($value['options'] as $key => $option) {
$id = $option_name . '-' . $value['id'] . '-' . $key;
$output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label><br />';
}
break;
// Image Selectors
// Image Selectors
//.........这里部分代码省略.........
开发者ID:AnkushVarshneya,项目名称:wordpress-theme,代码行数:101,代码来源:options-interface.php
示例8: onetone_of_get_options
function onetone_of_get_options($default = false)
{
//$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
// Gets the unique option id
//$option_name = $optionsframework_settings['id'];
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
} else {
$location = apply_filters('options_framework_location', array('includes/admin-options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = (require_once $optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
$options = apply_filters('of_options', $options);
$config = $options;
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
$options = $output;
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}
开发者ID:russtx,项目名称:tac,代码行数:42,代码来源:theme-setup.php
示例9: optionsframework_validate
function optionsframework_validate($input)
{
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
// If the reset button was clicked
if (!empty($_POST['reset'])) {
// If options are deleted sucessfully update the error message
if (delete_option($option_name)) {
add_settings_error('options-framework', 'restore_defaults', __('Default options restored.'), 'updated fade');
}
} else {
if (!empty($_POST['update'])) {
$clean = array();
// Get the options array we have defined in options.php
$options = optionsframework_options();
foreach ($options as $option) {
// Verify that the option has an id
if (isset($option['id'])) {
// Keep all ids lowercase with no spaces
$id = preg_replace('/\\W/', '', strtolower($option['id']));
// Set checkbox to false if it wasn't sent in the $_POST
if ('checkbox' == $option['type'] && !isset($input[$id])) {
$input[$id] = "0";
}
// Set each item in the multicheck to false if it wasn't sent in the $_POST
if ('multicheck' == $option['type'] && !isset($input[$id])) {
foreach ($option['options'] as $key => $value) {
$input[$id][$key] = "0";
}
}
// For a value to be submitted to database it must pass through a sanitization filter
if (isset($input[$id]) && has_filter('of_sanitize_' . $option['type'])) {
$clean[$id] = apply_filters('of_sanitize_' . $option['type'], $input[$id], $option);
}
}
// end isset $input
}
// end isset $id
}
// end foreach
if (isset($clean)) {
add_settings_error('options-framework', 'save_options', __('Options saved.'), 'updated fade');
return $clean;
// Return validated input
}
}
// end $_POST['update']
}
开发者ID:ridleyltd,项目名称:options-framework-plugin,代码行数:49,代码来源:options-framework.php
示例10: optionsframework_fields
/**
* Generates the options fields that are used in the form.
*/
function optionsframework_fields()
{
global $allowedtags;
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
} else {
$option_name = 'options_framework_theme';
}
$settings = get_option($option_name);
$options = optionsframework_options();
$counter = 0;
$menu = '';
foreach ($options as $value) {
$val = '';
$select_value = '';
$checked = '';
$output = '';
// Wrap all options
if ($value['type'] != "heading" && $value['type'] != "info") {
// Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
$id = 'section-' . $value['id'];
$class = 'section';
if (isset($value['type'])) {
$class .= ' section-' . $value['type'];
}
if (isset($value['class'])) {
$class .= ' ' . $value['class'];
}
$output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
if (isset($value['name'])) {
$output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
}
if ($value['type'] != 'editor') {
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
} else {
$output .= '<div class="option">' . "\n" . '<div>' . "\n";
}
}
// Set default value to $val
if (isset($value['std'])) {
$val = $value['std'];
}
// If the option is already saved, ovveride $val
if ($value['type'] != 'heading' && $value['type'] != 'info') {
if (isset($settings[$value['id']])) {
$val = $settings[$value['id']];
// Striping slashes of non-array options
if (!is_array($val)) {
$val = stripslashes($val);
}
}
}
// If there is a description save it for labels
$explain_value = '';
if (isset($value['desc'])) {
$explain_value = $value['desc'];
}
switch ($value['type']) {
// Basic text input
case 'text':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Password input
// Password input
case 'password':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
break;
// Textarea
// Textarea
case 'textarea':
$rows = '8';
if (isset($value['settings']['rows'])) {
$custom_rows = $value['settings']['rows'];
if (is_numeric($custom_rows)) {
$rows = $custom_rows;
}
}
$val = stripslashes($val);
$output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '">' . esc_textarea($val) . '</textarea>';
break;
// Select Box
// Select Box
case 'select':
$output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
foreach ($value['options'] as $key => $option) {
$selected = '';
if ($val != '') {
if ($val == $key) {
$selected = ' selected="selected"';
}
}
$output .= '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
}
$output .= '</select>';
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:101,代码来源:options-interface.php
示例11: onetone_on_switch_theme
function onetone_on_switch_theme()
{
global $onetone_options;
$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED . 'optionsframework');
if (!get_option($optionsframework_settings['id'])) {
$config = array();
$output = array();
$location = apply_filters('options_framework_location', array('admin-options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = (require_once $optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
if (isset($options)) {
$options = apply_filters('of_options', $options);
$config = $options;
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
}
add_option($optionsframework_settings['id'], $output);
}
$onetone_options = onetone_of_get_options();
}
开发者ID:Magnacarter,项目名称:livinghope.com,代码行数:38,代码来源:theme-setup.php
示例12: of_get_default_values
/**
* Format Configuration Array.
*
* Get an array of all default values as set in
* options.php. The 'id','std' and 'type' keys need
* to be defined in the configuration array. In the
* event that these keys are not present the option
* will not be included in this function's output.
*
* @return array Rey-keyed options configuration array.
*
* @access private
*/
function of_get_default_values()
{
$output = array();
$config = optionsframework_options();
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
if (has_filter('of_sanitize_' . $option['type'])) {
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
}
return $output;
}
开发者ID:foxydot,项目名称:madvia,代码行数:33,代码来源:options-framework.php
示例13: optionsframework_fields
function optionsframework_fields()
{
global $allowedtags;
$optionsframework_settings = get_option('optionsframework');
// Get the theme name so we can display it up top
$themename = wp_get_theme(STYLESHEETPATH . '/style.css');
$themename = $themename['Name'];
// Gets the unique option id
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
} else {
$option_name = 'optionsframework';
}
$settings = get_option($option_name);
$options = optionsframework_options();
$counter = 0;
$menu = '';
$output = '';
foreach ($options as $value) {
$counter++;
$val = '';
$select_value = '';
$checked = '';
// Wrap all options
if ($value['type'] != "heading" && $value['type'] != "info") {
// Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
$id = 'section-' . $value['id'];
$class = 'section ';
if (isset($value['type'])) {
$class .= ' section-' . $value['type'];
}
if (isset($value['class'])) {
$class .= ' ' . $value['class'];
}
$output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
$output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
}
// Set default value to $val
if (isset($value['std'])) {
$val = $value['std'];
}
// If the option is already saved, ovveride $val
if ($value['type'] != 'heading' && $value['type'] != 'info') {
if (isset($settings[$value['id']])) {
$val = $settings[$value['id']];
// Striping slashes of non-array options
if (!is_array($val)) {
$val = stripslashes($val);
}
}
}
// If there is a description save it for labels
$explain_value = '';
if (isset($value['desc'])) {
$explain_value = $value['desc'];
}
switch ($value['type']) {
// Basic text input
case 'text':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Textarea
// Textarea
case 'textarea':
$cols = '8';
$ta_value = '';
if (isset($value['options'])) {
$ta_options = $value['options'];
if (isset($ta_options['cols'])) {
$cols = $ta_options['cols'];
} else {
$cols = '8';
}
}
$val = stripslashes($val);
if (!isset($value['editor'])) {
$value['editor'] = '';
}
$output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input ' . esc_attr($value['editor']) . '" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
break;
// Select Box
// Select Box
case $value['type'] == 'select':
$output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
foreach ($value['options'] as $key => $option) {
$selected = '';
if ($val != '') {
if ($val == $key) {
$selected = ' selected="selected"';
}
}
$output .= '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
}
$output .= '</select>';
break;
// Select Box custom taxonomies
// Select Box custom taxonomies
case $value['type'] == 'select_tax':
//.........这里部分代码省略.........
开发者ID:Snaehild,项目名称:GH2016,代码行数:101,代码来源:options-interface.php
示例14: of_get_default
function of_get_default($option)
{
$defaults = optionsframework_options();
if (isset($defaults[$option]['std'])) {
return $defaults[$option]['std'];
}
return false;
// default if no std is set
}
开发者ID:aaghran,项目名称:aaghran.com,代码行数:9,代码来源:functions.php
示例15: meris_on_switch_theme
function meris_on_switch_theme()
{
global $meris_options;
$optionsframework_settings = get_option('optionsframework');
if (!get_option($optionsframework_settings['id'])) {
$config = array();
$output = array();
$location = apply_filters('options_framework_location', array('admin-options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = (require_once $optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
if (isset($options)) {
$options = apply_filters('of_options', $options);
$config = $options;
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
}
add_option($optionsframework_settings['id'], $output);
}
//Free version home page sections
if (!get_option('_meris_home_widget_area')) {
$sections_json = '{"section-widget-area-name":["Home Page Secion One","Home Page Secion Two","Home Page Secion Three","Home Page Secion Four"],"list-item-color":["","","",""],"list-item-image":["","","","' . esc_url(MERIS_THEME_BASE_URL . '/images/background-1.jpg') . '"],"list-item-repeat":["","","","no-repeat"],"list-item-position":["","","",""],"list-item-attachment":["","","",""],"widget-area-layout":["boxed","full","boxed","boxed"],"widget-area-padding":["50","50","50","50"],"widget-area-column":["1","1","1","2"],"widget-area-column-item":{"home-page-secion-one":["12"],"home-page-secion-two":["12"],"home-page-secion-three":["12"],"home-page-secion-four":["6","6"]}}';
add_option('_meris_home_widget_area', $sections_json);
}
$meris_options = meris_of_get_options();
}
开发者ID:liuminhan,项目名称:wordpress,代码行数:43,代码来源:theme-setup.php
示例16: cherry_register
function cherry_register($wp_customize)
{
/**
* This is optional, but if you want to reuse some of the defaults
* or values you already have built in the options panel, you
* can load them into $options for easy reference
*/
$options = optionsframework_options();
/*-----------------------------------------------------------------------------------*/
/* General
/*-----------------------------------------------------------------------------------*/
$wp_customize->add_section('cherry_header', array('title' => __('General', CURRENT_THEME), 'priority' => 200));
/* Background Image*/
$wp_customize->add_setting('cherry[body_background][image]', array('default' => $options['body_background']['std']['image'], 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'body_background_image', array('label' => 'Background Image', 'section' => 'cherry_header', 'settings' => 'cherry[body_background][image]')));
/* Background Color*/
$wp_customize->add_setting('cherry[body_background][color]', array('default' => $options['body_background']['std']['color'], 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_background', array('label' => 'Background Color', 'section' => 'cherry_header', 'settings' => 'cherry[body_background][color]')));
/* Header Color */
$wp_customize->add_setting('cherry[header_color]', array('default' => $options['header_color']['std'], 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_color', array('label' => $options['header_color']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[header_color]')));
/* Body Font Face */
$wp_customize->add_setting('cherry[google_mixed_3][face]', array('default' => $options['google_mixed_3']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_google_mixed_3', array('label' => $options['google_mixed_3']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[google_mixed_3][face]', 'type' => 'select', 'choices' => $options['google_mixed_3']['options']['faces']));
/* Buttons and Links Color */
$wp_customize->add_setting('cherry[links_color]', array('default' => $options['links_color']['std'], 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'links_color', array('label' => $options['links_color']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[links_color]')));
/* H1 Heading font face */
$wp_customize->add_setting('cherry[h1_heading][face]', array('default' => $options['h1_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h1_heading', array('label' => $options['h1_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h1_heading][face]', 'type' => 'select', 'choices' => $options['h1_heading']['options']['faces']));
/* H2 Heading font face */
$wp_customize->add_setting('cherry[h2_heading][face]', array('default' => $options['h2_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h2_heading', array('label' => $options['h2_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h2_heading][face]', 'type' => 'select', 'choices' => $options['h2_heading']['options']['faces']));
/* H3 Heading font face */
$wp_customize->add_setting('cherry[h3_heading][face]', array('default' => $options['h3_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h3_heading', array('label' => $options['h3_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h3_heading][face]', 'type' => 'select', 'choices' => $options['h3_heading']['options']['faces']));
/* H4 Heading font face */
$wp_customize->add_setting('cherry[h4_heading][face]', array('default' => $options['h4_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h4_heading', array('label' => $options['h4_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h4_heading][face]', 'type' => 'select', 'choices' => $options['h4_heading']['options']['faces']));
/* H5 Heading font face */
$wp_customize->add_setting('cherry[h5_heading][face]', array('default' => $options['h5_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h5_heading', array('label' => $options['h5_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h5_heading][face]', 'type' => 'select', 'choices' => $options['h5_heading']['options']['faces']));
/* H6 Heading font face */
$wp_customize->add_setting('cherry[h6_heading][face]', array('default' => $options['h6_heading']['std']['face'], 'type' => 'option'));
$wp_customize->add_control('cherry_h6_heading', array('label' => $options['h6_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h6_heading][face]', 'type' => 'select', 'choices' => $options['h6_heading']['options']['faces']));
/*-----------------------------------------------------------------------------------*/
/* Logo
/*-----------------------------------------------------------------------------------*/
$wp_customize->add_section('cherry_logo', array('title' => __('Logo', CURRENT_THEME), 'priority' => 201));
/* Logo Type */
$wp_customize->add_setting('cherry[logo_type]', array('default' => $options['logo_type']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_logo_type', array('label' => $options['logo_type']['name'], 'section' => 'cherry_logo', 'settings' => 'cherry[logo_type]', 'type' => $options['logo_type']['type'], 'choices' => $options['logo_type']['options']));
/* Logo Path */
$wp_customize->add_setting('cherry[logo_url]', array('type' => 'option'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_url', array('label' => $options['logo_url']['name'], 'section' => 'cherry_logo', 'settings' => 'cherry[logo_url]')));
/*-----------------------------------------------------------------------------------*/
/* Slider
/*-----------------------------------------------------------------------------------*/
$wp_customize->add_section('cherry_slider', array('title' => __('Slider', CURRENT_THEME), 'priority' => 202));
/* Slider Effect */
$wp_customize->add_setting('cherry[sl_effect]', array('default' => $options['sl_effect']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_effect', array('label' => $options['sl_effect']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_effect]', 'type' => $options['sl_effect']['type'], 'choices' => $options['sl_effect']['options']));
/* Pause time */
$wp_customize->add_setting('cherry[sl_pausetime]', array('default' => $options['sl_pausetime']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_pausetime', array('label' => $options['sl_pausetime']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_pausetime]', 'type' => $options['sl_pausetime']['type']));
/* Animation speed */
$wp_customize->add_setting('cherry[sl_animation_speed]', array('default' => $options['sl_animation_speed']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_animation_speed', array('label' => $options['sl_animation_speed']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_animation_speed]', 'type' => $options['sl_animation_speed']['type']));
/* Auto slideshow */
$wp_customize->add_setting('cherry[sl_slideshow]', array('default' => $options['sl_slideshow']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_slideshow', array('label' => $options['sl_slideshow']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_slideshow]', 'type' => $options['sl_slideshow']['type'], 'choices' => $options['sl_slideshow']['options']));
/* Slide thumbnails */
$wp_customize->add_setting('cherry[sl_thumbnails]', array('default' => $options['sl_thumbnails']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_thumbnails', array('label' => $options['sl_thumbnails']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_thumbnails]', 'type' => $options['sl_thumbnails']['type'], 'choices' => $options['sl_thumbnails']['options']));
/* Show pagination? */
$wp_customize->add_setting('cherry[sl_control_nav]', array('default' => $options['sl_control_nav']['std'], 'type' => 'option'));
$wp_customize->add_control('cherry_sl_control_nav', array('label' =>
|
请发表评论