コード例 #1
0
 /**
  * Default options
  *
  * Sets up the default options used on the settings page
  *
  * @access public
  */
 function create_options()
 {
     // Include settings so that we can run through defaults
     include_once 'admin/class-sp-admin-settings.php';
     $settings = SP_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         foreach ($section->get_settings() as $value) {
             if (isset($value['default']) && isset($value['id'])) {
                 $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                 add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
             }
         }
     }
     // Default color scheme
     add_option('sportspress_frontend_css_primary', '#2b353e');
     add_option('sportspress_frontend_css_background', '#f4f4f4');
     add_option('sportspress_frontend_css_text', '#222222');
     add_option('sportspress_frontend_css_heading', '#ffffff');
     add_option('sportspress_frontend_css_link', '#00a69c');
     if (!get_option('sportspress_installed')) {
         // Configure default sport
         $sport = 'custom';
         update_option('sportspress_sport', $sport);
         // Flag as installed
         update_option('sportspress_installed', 1);
     }
 }