static function get_instance() { // If it's the first grab, set the flag. if (self::$_instance == NULL) { self::$_instance = new CSST_TMD_Formatting(); } // Return the same copy of this class on each use. return self::$_instance; }
/** * Define our panels, sections, and settings. * * @return array An array of panels, containing sections, containing settings. */ function get_panels() { // A handy class for formatting strings. $formatting = CSST_TMD_Formatting::get_instance(); // Start an annoyingly huge array to define our panels, sections, and settings. $out = array(); // Define the body panel. $body = array('title' => esc_html__('Body', 'csst_tmd'), 'description' => esc_html__('Theme Mods for the Page Body', 'csst_tmd'), 'priority' => 20, 'sections' => array()); $out['body'] = $body; // Define the colors section, which resides in the body panel. $out['body']['sections']['colors'] = array('title' => esc_html__('Colors', 'csst_tmd'), 'description' => esc_html__('Colors for the Page Body', 'csst_tmd'), 'priority' => 10, 'settings' => array()); // The setting for body background color. $out['body']['sections']['colors']['settings']['background_color'] = array('type' => 'color', 'label' => esc_html__('Body Background Color', 'csst_tmd'), 'description' => esc_html('The background color for the body element, on landscape screens smaller than 800px.', 'csst_tmd'), 'priority' => 10, 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', 'sanitize_js_callback' => 'sanitize_hex_color', 'tinymce_css' => FALSE, 'css' => array(array('selector' => 'body', 'property' => 'background-color', 'queries' => array('max-width' => '800px', 'orientation' => 'landscape')))); // The setting for body text color. $out['body']['sections']['colors']['settings']['color'] = array('type' => 'color', 'label' => esc_html__('Body Text Color', 'csst_tmd'), 'description' => esc_html('The font color for the body element.', 'csst_tmd'), 'priority' => 20, 'default' => '#e18728', 'sanitize_callback' => 'sanitize_text_field', 'sanitize_js_callback' => 'sanitize_text_field', 'tinymce_css' => TRUE, 'css' => array(array('selector' => 'body', 'property' => 'color'))); // A new section within the body panel, called "layout". $out['body']['sections']['layout'] = array('title' => esc_html__('Layout Options', 'csst_tmd'), 'description' => esc_html__('Layout Options for the Page Body', 'csst_tmd'), 'priority' => 20, 'settings' => array()); // A setting for max-width for the body. $out['body']['sections']['layout']['settings']['max_width'] = array('type' => 'text', 'label' => esc_html__('Body Max Width', 'csst_tmd'), 'description' => esc_html('The max-width for the body element.', 'csst_tmd'), 'priority' => 10, 'default' => FALSE, 'sanitize_callback' => array($formatting, 'sanitize_linear_css'), 'sanitize_js_callback' => array($formatting, 'sanitize_linear_css'), 'css' => array(array('selector' => 'body', 'property' => 'max-width', 'queries' => array('min-width' => '400px')))); return $out; }