function layers_generate_customizer_fonts() { global $layers_custom_fonts; // Apply Font Styles $customizer_options = new Layers_Customizer_Config(); foreach ($customizer_options->controls() as $controls) { foreach ($controls as $control_key => $control_data) { if ('layers-font' == $control_data['type'] && layers_get_theme_mod($control_key)) { // Add fonts to a bucket for registration $layers_custom_fonts[] = layers_get_theme_mod($control_key); layers_inline_styles($control_data['selectors'], 'font-family', array('font-family' => layers_get_theme_mod($control_key))); } } } }
/** * Get Instance creates a singleton class that's cached to stop duplicate instances */ public static function get_instance() { if (!self::$instance) { self::$instance = new self(); self::$instance->init(); } return self::$instance; }
/** * Init behaves like, and replaces, construct */ public function init() { global $layers_customizer_defaults; // Setup prefix to use $this->prefix = LAYERS_THEME_SLUG . '-'; // Grab the customizer config $this->config = Layers_Customizer_Config::get_instance(); foreach ($this->config->controls as $section_key => $controls) { foreach ($controls as $control_key => $control_data) { // Set key to use for the default $setting_key = $this->prefix . $control_key; // Register default $this->register_control_defaults($setting_key, $control_data['type'], isset($control_data['default']) ? $control_data['default'] : NULL); } } $layers_customizer_defaults = apply_filters('layers_customizer_defaults', $layers_customizer_defaults); }
/** * Init behaves like, and replaces, construct */ public function init() { // Register the customizer object global $wp_customize; $this->customizer = $wp_customize; // Set Prefix $this->prefix = LAYERS_THEME_SLUG . '-'; // Grab the customizer config $this->config = Layers_Customizer_Config::get_instance(); //Register the panels and sections based on this instance's config // Start registration with the panels & sections $this->register_panels($this->config->panels); $this->register_sections($this->config->sections); // Move default sections into Layers Panels $this->move_default_sections($this->config->default_sections); // Change 'Widgets' panel title to 'Edit Layout' $wp_customize->add_panel('widgets', array('priority' => 0, 'title' => __('Edit Layout', 'layerswp'), 'description' => Layers_Customizer::get_instance()->render_builder_page_dropdown() . __('Use this area to add widgets to your page, use the (Layers) widgets for the Body section.', 'layerswp'))); }