'Serif', 'sans-serif' => 'Sans Serif', 'helvetica' => 'Helvetica', 'helvetica neue' => 'Helvetica Neue', 'monospace' => 'Monospaced', ); $panel = 'affvc-typography'; $panels[] = array( 'id' => $panel, 'title' => __('Typography', 'affilivice'), 'priority' => '20' ); $section = 'affvc-typography-headline'; $sections[] = array( 'id' => $section, 'title' => __('Headline', 'affilivice'), 'priority' => '10', 'panel' => $panel ); $options['affvc-typography-headline-font-family'] = array( 'id' => 'affvc-typography-headline-font-family', 'label' => __('Font Family', 'affilivice'), 'section' => $section, 'type' => 'select', 'choices' => $font_choices, 'default' => 'helvetica neue', 'transport' => 'postMessage' ); $options['affvc-typography-headline-color'] = array( 'id' => 'affvc-typography-headline-color', 'label' => __('Color', 'affilivice'), 'section' => $section, 'type' => 'color', 'default' => '#000', 'transport' => 'postMessage', ); $section = 'affvc-typography-text'; $sections[] = array( 'id' => $section, 'title' => __('Text', 'affilivice'), 'priority' => '11', 'panel' => $panel ); $options['affvc-typography-text-font-family'] = array( 'id' => 'affvc-typography-text-font-family', 'label' => __('Font Family', 'affilivice'), 'section' => $section, 'type' => 'select', 'choices' => $font_choices, 'default' => 'helvetica neue', 'transport' => 'postMessage' ); $options['affvc-typography-text-color'] = array( 'id' => 'affvc-typography-text-color', 'label' => __('Color', 'affilivice'), 'section' => $section, 'type' => 'color', 'default' => '#555', 'transport' => 'postMessage', ); $section = 'affvc-typography-link'; $sections[] = array( 'id' => $section, 'title' => __('Link', 'affilivice'), 'priority' => '11', 'panel' => $panel ); $options['affvc-typography-link-font-family'] = array( 'id' => 'affvc-typography-link-font-family', 'label' => __('Font Family', 'affilivice'), 'section' => $section, 'type' => 'select', 'choices' => $font_choices, 'default' => 'helvetica neue', 'transport' => 'postMessage' ); $options['affvc-typography-link-color'] = array( 'id' => 'affvc-typography-link-color', 'label' => __('Color', 'affilivice'), 'section' => $section, 'type' => 'color', 'default' => '#3bafda', 'transport' => 'postMessage', ); $options['affvc-typography-link-color-hover'] = array( 'id' => 'affvc-typography-link-color-hover', 'label' => __('Color (Hover)', 'affilivice'), 'section' => $section, 'type' => 'color', 'default' => '#3fc2ea', 'transport' => 'postMessage', ); $options['sections'] = $sections; $options['panels'] = $panels; return $options; } /** * @inheritdoc * @since 0.6 */ public function render() { $this->render_selectors('affvc-typography-headline-font-family', function ($mod) { $stack = customizer_library_get_font_stack($mod); return array( 'selectors' => array( 'h1, h2, h3, h4, h5, h6' ), 'declarations' => array( 'font-family' => $stack ) ); }); $this->render_selectors('affvc-typography-headline-color', function ($mod) { $color = sanitize_hex_color($mod); return array( 'selectors' => array( 'main h1', 'main h2', 'main h3', 'main h4', 'main h5', 'main h6' ), 'declarations' => array( 'color' => $color ) ); }); $this->render_selectors('affvc-typography-text-font-family', function ($mod) { $stack = customizer_library_get_font_stack($mod); return array( 'selectors' => array( 'main', 'main p', 'main span', 'main li', 'main time', ), 'declarations' => array( 'font-family' => $stack ) ); }); $this->render_selectors('affvc-typography-text-color', function ($mod) { $color = sanitize_hex_color($mod); return array( 'selectors' => array( 'main', 'main p', 'main span', 'main li', 'main time', ), 'declarations' => array( 'color' => $color ) ); }); $this->render_selectors('affvc-typography-link-font-family', function ($mod) { $stack = customizer_library_get_font_stack($mod); return array( 'selectors' => array( 'main a:not(.price, .btn, [rel="tag"], [rel="category"])', 'main a > span.unit' ), 'declarations' => array( 'font-family' => $stack ) ); }); $this->render_selectors('affvc-typography-link-color', function ($mod) { $color = sanitize_hex_color($mod); return array( 'selectors' => array( 'main a:not(.price, .btn, [rel="tag"], [rel="category"], [rel="category tag"])', 'main a > span.unit' ), 'declarations' => array( 'color' => $color ) ); }); $this->render_selectors('affvc-typography-link-color-hover', function ($mod) { $color = sanitize_hex_color($mod); return array( 'selectors' => array( 'main a:hover:not(.price, .btn, [rel="tag"], [rel="category"], [rel="tag"], [rel="category tag"])', 'main a > span.unit:hover' ), 'declarations' => array( 'color' => $color ) ); }); } /** * @inheritdoc * @since 0.6 */ public function enqueue_scripts() { // Font options $fonts = array( get_theme_mod('affvc-typography-headline-font-family', customizer_library_get_default('affvc-typography-headline-font-family')), ); $font_uri = customizer_library_get_google_font_uri($fonts); // Load Google Fonts wp_enqueue_style('fonts', $font_uri, array(), null, 'screen'); } }