Example #1
0
    {
        // Only need to initiate the array once per page-load
        if (!empty(self::$theme_options)) {
            return self::$theme_options;
        }
        self::$theme_options = array('id' => 'theme_options', 'show_on' => array('key' => 'options-page', 'value' => array(self::$key)), 'show_names' => true, 'fields' => array(array('name' => __('Place Name', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'place_name', 'type' => 'text_medium'), array('name' => __('City', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'city_name', 'type' => 'text_medium'), array('name' => __('Phone number', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'phone', 'type' => 'text_medium'), array('name' => __('place address', 'bookingwp'), 'desc' => __('es via roma 10, 00100 Roma', 'bookingwp'), 'id' => 'place_address', 'type' => 'text_medium'), array('name' => __('email', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'email', 'type' => 'text_email'), array('name' => __('Facebook page URL', 'cmb'), 'id' => $prefix . 'facebook_url', 'type' => 'text_url'), array('name' => __('Twitter URL', 'cmb'), 'id' => $prefix . 'twitter_url', 'type' => 'text_url'), array('name' => __('Test Color Picker', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'test_colorpicker', 'type' => 'colorpicker', 'default' => '#ffffff'), array('name' => __('Footer Text', 'bookingwp'), 'desc' => __('field description (optional)', 'bookingwp'), 'id' => 'footer_text', 'type' => 'text'), array('name' => __('Amenities IT', 'bookingwp'), 'desc' => __('servizi (separati da virgola)', 'bookingwp'), 'id' => 'custom_services_list_it', 'type' => 'text'), array('name' => __('Amenities EN', 'bookingwp'), 'desc' => __('servizi (separati da virgola)', 'bookingwp'), 'id' => 'custom_services_list_en', 'type' => 'text')));
        return self::$theme_options;
    }
    /**
     * Make public the protected $key variable.
     * @since  0.1.0
     * @return string  Option key
     */
    public static function key()
    {
        return self::$key;
    }
}
// Get it started
$ThemeSettings = new ThemeSettings();
$ThemeSettings->hooks();
/**
 * Wrapper function around cmb_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function mytheme_get_option($key = '')
{
    return cmb_get_option(ThemeSettings::key(), $key);
}