array('face'=>'Open Sans', 'weight'=>'normal', 'transform'=>'none', 'size'=>'14px', 'height'=>'21px'), 'heading_font' => array('face'=>'Montserrat', 'weight'=>'bold', 'transform'=>'none') ); /** * Converts a HEX value to RGB. * * @since Amanda Pro 1.0 * * @param string $color The original color, in 3- or 6-digit hexadecimal form. * @return array Array containing RGB (red, green, and blue) values for the given * HEX code, empty array otherwise. */ function amanda_hex2rgb( $color ) { $color = trim( $color, '#' ); if ( strlen( $color ) === 3 ) { $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); } else if ( strlen( $color ) === 6 ) { $r = hexdec( substr( $color, 0, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) ); } else { return array(); } return array( 'red' => $r, 'green' => $g, 'blue' => $b ); } /** * * @since Amanda 1.0 * * @return array of typography sizes. */ function amanda_get_typography_sizes($min=9, $max=90) { $array_sizes = array(); for ($i = $min; $i < $max; $i++){ $array_sizes[$i.'px'] = $i.'px'; } return $array_sizes; } if ( ! function_exists( 'amanda_sanitize_menu_color' ) ) : /** * Handles sanitization for Amanda color schemes. * * @return string menu color scheme. */ function amanda_sanitize_menu_color( $value ) { global $color_schemes; if ( ! array_key_exists( $value, $color_schemes ) ) { return 'dark light-content'; } return $value; } endif; // amanda_sanitize_menu_color if ( ! function_exists( 'amanda_sanitize_strip_slashes' ) ) : /** * Adds sanitization callback function: Strip Slashes * @package Dazzling */ function amanda_sanitize_strip_slashes($input) { return wp_kses_stripslashes($input); } endif; // amanda_sanitize_strip_slashes /** * Sanitize checkbox for WordPress customizer */ function amanda_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } /** * Validates text input from Customizer text controls. * * @since Amanda 1.0 */ function amanda_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } /** * Validates input from Customizer pixel values. * * @since Amanda 1.0 */ function amanda_sanitize_pixels( $input ) { if( strpos('px', $input)>=0 ) return $input; else return $input.'px'; } /** * Validates number input from Customizer number controls. * * @since Amanda 1.0 */ function amanda_sanitize_number( $input ) { return force_balance_tags( $input ); } /** * Adds sanitization callback function: Site Layout * * @since Amanda 1.0 */ function amanda_sanitize_navigation_align( $input ) { global $navigation_aligns; if ( array_key_exists( $input, $navigation_aligns ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Image Size * * @since Amanda 1.0 */ function amanda_sanitize_image_size( $input ) { global $image_sizes; if ( array_key_exists( $input, $image_sizes ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Pagination styles * * @since Amanda 1.0 */ function amanda_sanitize_pagination_style( $input ) { global $pagination_styles; if ( array_key_exists( $input, $pagination_styles ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Gutter * * @since Amanda 1.0 */ function amanda_sanitize_gutter( $input ) { global $gutter_sizes; if ( array_key_exists( $input, $gutter_sizes ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Blog Archive Display * * @since Amanda 1.0 */ function amanda_sanitize_blog_archive_display( $input ) { global $blog_styles; if ( array_key_exists( $input, $blog_styles ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Caption Effect * * @since Amanda 1.0 */ function amanda_sanitize_caption_effect( $input ) { global $caption_effects; if ( array_key_exists( $input, $caption_effects ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Typography Transforms * * @since Amanda 1.0 */ function amanda_sanitize_typo_transform( $input ) { global $typography_defaults; if ( array_key_exists( $input, $typography_defaults['transforms'] ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: Typography Weights * * @since Amanda 1.0 */ function amanda_sanitize_typo_weight( $input ) { global $typography_defaults; if ( array_key_exists( $input, $typography_defaults['weights'] ) ) { return $input; } else { return ''; } } /** * Adds sanitization callback function: colors * @package Amanda */ function amanda_sanitize_hex_color($color) { if ($unhashed = sanitize_hex_color_no_hash($color)) return '#' . $unhashed; return $color; } /** * Adds sanitization callback function: Nohtml * @package Amanda */ function amanda_sanitize_nohtml($input) { return wp_filter_nohtml_kses($input); } if ( ! function_exists( 'amanda_header_style' ) ) : /** * Styles the header text displayed on the site. * * Create your own amanda_header_style() function to override in a child theme. * * @since Twenty Sixteen 1.0 * * @see amanda_custom_header_and_background(). */ function amanda_header_style() { // If the header text option is untouched, let's bail. if ( display_header_text() ) { return; } // If the header text has been hidden. ?> cat_ID] = $category->cat_name; } global $navigation_aligns; $navigation_aligns = array('nav-left' => 'Left', 'nav-right' => 'Right'); global $gutter_sizes; $gutter_sizes = array('10' => '10', '15' => '15', '20' => '20'); global $image_sizes; $image_sizes = array('large-thumbnail'=>'790xH', 'medium-thumbnail'=>'680x580', 'square-thumbnail'=>'640x640', 'portrait-thumbnail'=>'640x900', 'landscape-thumbnail'=>'680x450'); global $pagination_styles; $pagination_styles = array('load-more'=>'load more button', 'page-numbers'=>'Page numbers'); global $caption_effects; $caption_effects = array('cs cs-fade-in'=>'Fade in', 'cs cs-slide-up'=>'Slide up', 'cs cs-slide-left'=>'Slide left'); global $blog_styles; $blog_styles = array('standard'=>'standard', 'masonry'=>'masonry', 'grid'=>'grid', 'boxed standard'=>'boxed standard', 'boxed masonry'=>'boxed masonry'); global $color_schemes; $color_schemes = array( 'dark light-content'=> 'Dark', 'light black-content'=> 'Light', 'black light-content'=> 'Black', 'white black-content'=> 'White' ); // Typography Options global $typography_defaults; $typography_defaults = array( 'sizes' => array( '6px' => '6px','10px' => '10px','12px' => '12px','14px' => '14px','15px' => '15px','16px' => '16px','18'=> '18px','20px' => '20px','24px' => '24px','28px' => '28px','32px' => '32px','36px' => '36px','42px' => '42px','48px' => '48px' ), 'faces' => array( 'arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'Open Sans' => 'Open Sans', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica', 'helvetica-neue' => 'Helvetica Neue,Helvetica,Arial,sans-serif' ), 'transforms' => array( 'none' => 'Normal','uppercase' => 'Uppercase' ), 'weights' => array( 'normal' => 'Normal','bold' => 'Bold' ), 'heights' => array( '12px' => '12px','13px' => '13px','14px' => '14px','15px' => '15px','16px' => '16px' ), 'color' => true ); $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; /* Main option Settings Panel */ $wp_customize->add_panel('amanda_options', array( 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Amanda Options', 'amanda-lite'), 'description' => __('Panel to update amanda theme options', 'amanda-lite'), // Include html tags such as
. 'priority' => 10 // Mixed with top-level-section hierarchy. )); // Add menu color setting and control. $wp_customize->add_setting( 'amanda[menu_color]', array( 'default' => 'dark light-content', 'sanitize_callback' => 'amanda_sanitize_menu_color', 'type' => 'option', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'amanda[menu_color]', array( 'label' => __( 'Menu Color Scheme', 'amanda-lite' ), 'section' => 'colors', 'type' => 'select', 'choices' => $color_schemes, 'priority' => 1, ) ); // Add accent color setting and control. $wp_customize->add_setting('amanda[accent_color]', array( 'default' => '#fe19a0', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_hex_color', 'transport' => 'postMessage', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'amanda[accent_color]', array( 'label' => __( 'Accent color', 'amanda-lite' ), 'section' => 'colors', ))); // Remove the core header textcolor control, as it shares the main text color. $wp_customize->remove_control( 'header_textcolor' ); $wp_customize->remove_control( 'background_color' ); /* Amanda Main Options */ $wp_customize->add_section('amanda_general_options', array( 'title' => __('General options', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); /* Site Logo */ $wp_customize->add_setting( 'amanda[logo]', array('type' => 'option', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'amanda[logo]', array( 'label' => __( 'Logo', 'amanda-lite' ), 'section' => 'amanda_general_options', 'settings' => 'amanda[logo]', 'priority' => 1, ))); /* Small Logo in sidebar */ $wp_customize->add_setting( 'amanda[logo_small]', array('type' => 'option', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'amanda[logo_small]', array( 'label' => __( 'Small Logo for sidebar', 'amanda-lite' ), 'section' => 'amanda_general_options', 'settings' => 'amanda[logo_small]', 'priority' => 1, ))); /* Enable preloader */ $wp_customize->add_setting( 'amanda[enable_preloader]', array( 'default' => 0, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox' )); $wp_customize->add_control( 'amanda[enable_preloader]', array( 'type' => 'checkbox', 'label' => __('Enable preloader for every pages?','amanda-lite'), 'section' => 'amanda_general_options', 'priority' => 2, ) ); // Smooth Scroll $wp_customize->add_setting( 'amanda[smooth_scroll]', array( 'default' => 0, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox', ) ); $wp_customize->add_control( 'amanda[smooth_scroll]', array( 'label' => esc_html__( 'Enable smooth scroll?', 'amanda-lite' ), 'section' => 'amanda_general_options', 'priority' => 5, 'type' => 'checkbox', ) ); // Copyright text $wp_customize->add_setting('amanda[copyright_text]', array( 'default' => '© 2016 POGOTHEMESPowered by Wordpress.', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[copyright_text]', array( 'label' => __('Copyright Text', 'amanda-lite'), 'description' => sprintf(__('Enter your copyright text', 'amanda-lite')), 'section' => 'amanda_general_options', 'type' => 'textarea' )); /* Typography options */ $wp_customize->add_section('amanda_layout_options', array( 'title' => __('Layout options', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); // Navigation Align $wp_customize->add_setting('amanda[navigation_align]', array( 'default' => 'nav-left', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_navigation_align' )); $wp_customize->add_control('amanda[navigation_align]', array( 'label' => __('Navigation Align', 'amanda-lite'), 'section' => 'amanda_layout_options', 'type' => 'select', 'choices' => $navigation_aligns )); // Gutter Size $wp_customize->add_setting('amanda[gutter]', array( 'default' => '15', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_gutter' )); $wp_customize->add_control('amanda[gutter]', array( 'label' => __('Gutter Size', 'amanda-lite'), 'section' => 'amanda_layout_options', 'type' => 'select', 'choices' => $gutter_sizes )); /* Blog options */ $wp_customize->add_section('amanda_blog_options', array( 'title' => __('Blog options', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); // Portfolio title $wp_customize->add_setting('amanda[header_text]', array( 'default' => '', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[header_text]', array( 'label' => __('Header text', 'amanda-lite'), 'description' => __('Short header text for your blog', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'textarea' )); // Show Excerpts $wp_customize->add_setting( 'amanda[show_excerpts]', array( 'default' => 1, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox', ) ); $wp_customize->add_control( 'amanda[show_excerpts]', array( 'label' => __('Show excerpts in blog posts.', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'checkbox', ) ); // Excerpt length $wp_customize->add_setting( 'amanda[excerpt_length]', array( 'sanitize_callback' => 'amanda_sanitize_number', 'type' => 'option', 'default' => '24' )); $wp_customize->add_control( new Amanda_Number_Control( $wp_customize, 'amanda[excerpt_length]', array( 'type' => 'number', 'label' => __('Excerpt length', 'amanda-lite'), 'section' => 'amanda_blog_options', 'settings' => 'amanda[excerpt_length]', ) ) ); // Blog Archive Style $wp_customize->add_setting('amanda[blog_archive_display]', array( 'default' => 'boxed masonry', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_blog_archive_display' )); $wp_customize->add_control('amanda[blog_archive_display]', array( 'label' => __('Blog archive display', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'select', 'description' => __('Choose how you want to display your blog posts on archive pages.', 'amanda-lite'), 'choices' => $blog_styles )); // Show Post Thumbnail $wp_customize->add_setting( 'amanda[show_post_thumbnail]', array( 'default' => 0, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox', ) ); $wp_customize->add_control( 'amanda[show_post_thumbnail]', array( 'label' => esc_html__( 'Check if you want to display post thumbnail in single post.', 'amanda-lite' ), 'section' => 'amanda_blog_options', 'type' => 'checkbox', ) ); /* Post Thumbnail placeholder */ $wp_customize->add_setting( 'amanda[post_thumbnail_placeholder]', array('type' => 'option', 'sanitize_callback' => 'amanda_sanitize_number')); $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'amanda[post_thumbnail_placeholder]', array( 'label' => __( 'Post Thumbnail placeholder', 'amanda-lite' ), 'description' => __('Add placeholder image for posts without thumbnail.', 'amanda-lite'), 'section' => 'amanda_blog_options', 'settings' => 'amanda[post_thumbnail_placeholder]', ))); // Show Blog Sidebar $wp_customize->add_setting( 'amanda[show_blog_sidebar]', array( 'default' => 0, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox', ) ); $wp_customize->add_control( 'amanda[show_blog_sidebar]', array( 'label' => __('Display sidebar in single blog posts.', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'checkbox', ) ); // Blog Image size $wp_customize->add_setting('amanda[blog_image_size]', array( 'default' => 'large-thumbnail', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_image_size' )); $wp_customize->add_control('amanda[blog_image_size]', array( 'label' => __('Blog image size', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'select', 'description' => __('Choose the image size for blog archive.', 'amanda-lite'), 'choices' => $image_sizes )); // Blog archive pagination $wp_customize->add_setting('amanda[blog_archive_pagination]', array( 'default' => 'load-more', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_pagination_style' )); $wp_customize->add_control('amanda[blog_archive_pagination]', array( 'label' => __('Blog archive pagination', 'amanda-lite'), 'section' => 'amanda_blog_options', 'type' => 'select', 'description' => __('Choose the pagination style for blog archive.', 'amanda-lite'), 'choices' => $pagination_styles )); /* Enable social share */ $wp_customize->add_setting( 'amanda[show_social_share]', array( 'default' => 0, 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_checkbox' )); $wp_customize->add_control( 'amanda[show_social_share]', array( 'type' => 'checkbox', 'label' => __('Show social share in single post','amanda-lite'), 'section' => 'amanda_blog_options', ) ); /* Portfolio options */ $wp_customize->add_section('amanda_portfolio_options', array( 'title' => __('Portfolio options', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); // Portfolio title $wp_customize->add_setting('amanda[portfolio_title]', array( 'default' => '', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[portfolio_title]', array( 'label' => __('Portfolio Title', 'amanda-lite'), 'description' => sprintf(__('Enter title text for filterable portfolio', 'amanda-lite')), 'section' => 'amanda_portfolio_options', 'type' => 'textarea' )); // Caption effect $wp_customize->add_setting('amanda[portfolio_caption_effect]', array( 'default' => 'cs cs-slide-up', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_caption_effect' )); $wp_customize->add_control('amanda[portfolio_caption_effect]', array( 'label' => __('Portfolio archive caption effect', 'amanda-lite'), 'section' => 'amanda_portfolio_options', 'type' => 'select', 'description' => __('Choose the caption effect for portfolio archive.', 'amanda-lite'), 'choices' => $caption_effects )); // Portfolio count $wp_customize->add_setting( 'amanda[portfolio_count]', array('sanitize_callback' => 'amanda_sanitize_number', 'default' => '12')); $wp_customize->add_control( new Amanda_Number_Control( $wp_customize, 'amanda[portfolio_count]', array( 'type' => 'number', 'label' => __('Number of items', 'amanda-lite'), 'section' => 'amanda_portfolio_options', 'settings' => 'amanda[portfolio_count]', 'priority' => 8 ) ) ); // Portfolio Image size $wp_customize->add_setting('amanda[portfolio_image_size]', array( 'default' => 'portrait-thumbnail', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_image_size' )); $wp_customize->add_control('amanda[portfolio_image_size]', array( 'label' => __('Portfolio image size', 'amanda-lite'), 'section' => 'amanda_portfolio_options', 'type' => 'select', 'description' => __('Choose the image size for portfolio archive.', 'amanda-lite'), 'choices' => $image_sizes )); /* Social Networks */ $wp_customize->add_section('amanda_social_options', array( 'title' => __('Social Networks', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); // Facebook URL $wp_customize->add_setting('amanda[facebook_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[facebook_url]', array( 'label' => __('Facebook URL', 'amanda-lite'), 'description' => sprintf(__('Enter your Facebook URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); // Twitter URL $wp_customize->add_setting('amanda[twitter_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[twitter_url]', array( 'label' => __('Twitter URL', 'amanda-lite'), 'description' => sprintf(__('Enter your Twitter URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); // Instagram URL $wp_customize->add_setting('amanda[instagram_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[instagram_url]', array( 'label' => __('Instagram URL', 'amanda-lite'), 'description' => sprintf(__('Enter your Instagram URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); // YouTube URL $wp_customize->add_setting('amanda[youtube_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[youtube_url]', array( 'label' => __('YouTube URL', 'amanda-lite'), 'description' => sprintf(__('Enter your YouTube URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); // Behance URL $wp_customize->add_setting('amanda[behance_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[behance_url]', array( 'label' => __('Behance URL', 'amanda-lite'), 'description' => sprintf(__('Enter your Behance URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); // Dribbble URL $wp_customize->add_setting('amanda[dribbble_url]', array( 'default' => '', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' )); $wp_customize->add_control('amanda[dribbble_url]', array( 'label' => __('Dribbble URL', 'amanda-lite'), 'description' => sprintf(__('Enter your Dribbble URL', 'amanda-lite')), 'section' => 'amanda_social_options' )); /* Typography Options */ $wp_customize->add_section('amanda_typography_options', array( 'title' => __('Typography', 'amanda-lite'), 'priority' => 31, 'panel' => 'amanda_options' )); global $font_defaults; // Body Font $wp_customize->add_setting( 'amanda[body_font][face]', array( 'default' => $font_defaults['body_font']['face'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' ) ); $wp_customize->add_control( new Google_Font_Dropdown_Custom_Control( $wp_customize, 'amanda[body_font][face]', array( 'label' => __('Body font face', 'amanda-lite'), 'description' => __('Choose your body font', 'amanda-lite'), 'section' => 'amanda_typography_options', 'settings' => 'amanda[body_font][face]', ) ) ); $wp_customize->add_setting('amanda[body_font][size]', array( 'default' => $font_defaults['body_font']['size'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_pixels' )); $wp_customize->add_control('amanda[body_font][size]', array( 'label' => __('Body font size', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => amanda_get_typography_sizes(), )); $wp_customize->add_setting('amanda[body_font][height]', array( 'default' => $font_defaults['body_font']['height'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_pixels' )); $wp_customize->add_control('amanda[body_font][height]', array( 'label' => __('Body font height', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => amanda_get_typography_sizes(14,40) )); $wp_customize->add_setting('amanda[body_font][transform]', array( 'default' => $font_defaults['body_font']['transform'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_typo_transform' )); $wp_customize->add_control('amanda[body_font][transform]', array( 'label' => __('Body font transform', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => $typography_defaults['transforms'] )); // Heading font $wp_customize->add_setting( 'amanda[heading_font][face]', array( 'default' => $font_defaults['heading_font']['face'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_strip_slashes' ) ); $wp_customize->add_control( new Google_Font_Dropdown_Custom_Control( $wp_customize, 'amanda[heading_font][face]', array( 'label' => __('Heading font face', 'amanda-lite'), 'description' => __('Choose your heading font', 'amanda-lite'), 'section' => 'amanda_typography_options', 'settings' => 'amanda[heading_font][face]', ) ) ); $wp_customize->add_setting('amanda[heading_font][weight]', array( 'default' => $font_defaults['heading_font']['weight'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_typo_weight' )); $wp_customize->add_control('amanda[heading_font][weight]', array( 'label' => __('Heading font weight', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => $typography_defaults['weights'] )); $wp_customize->add_setting('amanda[heading_font][transform]', array( 'default' => $font_defaults['heading_font']['transform'], 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_typo_transform' )); $wp_customize->add_control('amanda[heading_font][transform]', array( 'label' => __('Heading font transform', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => $typography_defaults['transforms'] )); $wp_customize->add_setting('amanda[header_text_size]', array( 'default' => '26px', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_pixels' )); $wp_customize->add_control('amanda[header_text_size]', array( 'label' => __('Header text size', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => amanda_get_typography_sizes(), )); $wp_customize->add_setting('amanda[post_title_size]', array( 'default' => '19px', 'type' => 'option', 'sanitize_callback' => 'amanda_sanitize_pixels' )); $wp_customize->add_control('amanda[post_title_size]', array( 'label' => __('Post title size', 'amanda-lite'), 'section' => 'amanda_typography_options', 'type' => 'select', 'choices' => amanda_get_typography_sizes(), )); $wp_customize->add_section('amanda_info', array( 'priority' => 5, 'title' => __('About Amanda Pro', 'amanda-lite') )); $wp_customize->add_setting('amanda[info]', array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new Amanda_Pro_Info( $wp_customize, 'amanda[info]', array( 'section' => 'amanda_info', 'type' => 'amanda-info' ))); } add_action( 'customize_register', 'amanda_customizer' ); /** * Binds JS handlers to make the Customizer preview reload changes asynchronously. * * @since Amanda 1.0 */ function amanda_customize_preview_js() { wp_enqueue_script( 'amanda-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20150825', true ); } add_action( 'customize_preview_init', 'amanda_customize_preview_js' ); /** * Enqueues front-end CSS for the Accent color. * * @since Amanda 1.0 * * @see wp_add_inline_style() */ function amanda_accent_color_css() { $accent_color = pogo_get_option( 'accent_color', '#fe19a0' ); // Don't do anything if the current color is the default. // if ( $accent_color === $default_color ) { // return; // } $css = ' /* Custom Accent Color */ ::selection {color:#fff;background: %1$s;} ::-moz-selection {color:#fff;background: %1$s;} .no-mobile.single-portfolio .portfolio-details.floating.closed, .call-to-action a, .tabs .tabs-nav li.active a, .toggle-title.ui-state-active, .accordion-title.ui-state-active, .nav-pagination.nav-opaque .section-navigation .active a span, .section-navigation .tooltip-inner, .wpb_content_element .wpb_tabs_nav li.ui-tabs-active a, .blog.slider .post .post-category a, .blog.masonry .post .post-category a, .blog.standard .post .post-category a, .highlight, .portfolio-services li, .button:hover, .wpcf7-submit:hover, .form-submit [type="submit"]:hover, .accordion.with-background.colored-title .accordion-title, .swiper-pagination-bullet.swiper-pagination-bullet-active, .pricing-table.featured {background: %1$s;} .caption.colored, ul.custom.colored-icon li i, .colored {color: %1$s !important;} .blog .post .content .button, .box-item .filter h3, .portfolio-navigation a:hover, .portfolio-details p a, .blog.masonry .post:hover a.more-link, .single-portfolio .portfolio-details .title, .social-networks a:hover, .comment-body .reply a:hover, .portfolio-filter li a.selected, .portfolio-filter li a:hover, .multi-level-nav .mcp-menu li.current-menu-item:first-child > a, .multi-level-nav .mcp-menu li.ml-current-menu-item > a, .multi-level-nav .slide-text-effect a span::before, .site-nav-top .active a, .site-nav-top a:hover, .main-article a, .portfolio-filter li a.selected, .portfolio-filter li a:hover, .single-portfolio .portfolio-details.floating .btn-close i:before{color: %1$s;} .section-navigation .tooltip.left .tooltip-arrow { border-left-color: %1$s;} .section-navigation .tooltip.right .tooltip-arrow { border-right-color: %1$s;} .no-mobile .cs.cs-fade-in .image-overlay, a.button.theme-color, a.button.theme-color-1, .tp-bannertimer {background: %1$s;} a.button {background: %1$s;} .vc_progress_bar .vc_single_bar .vc_bar {background-color: %1$s; } .element-title strong, .logo h1 {color: %1$s;} '; wp_add_inline_style( 'amanda-style', sprintf( $css, $accent_color ) ); } add_action( 'wp_enqueue_scripts', 'amanda_accent_color_css', 11 ); /* Add custom style */ if ( ! function_exists( 'amanda_gutter_css' ) ) : /** * Adds customized CSS styles with theme option variables * * @since Amanda 1.0 */ function amanda_gutter_css() { global $wp_styles; /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ // if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) // wp_enqueue_script( 'comment-reply' ); $gutter = pogo_get_option('gutter', 10).'px'; $margin = ($gutter*2).'px'; $css = ' /* custom gutter */ .icon-box, .filterable-portfolio .box-item, .blog.masonry .box-item { margin-bottom: %1$s; } .row { margin-left: -%2$s; margin-right: -%2$s; } .blog.masonry .grid-sizer, .blog.masonry .box-item, .container, .container-fluid, .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { padding-left: %2$s; padding-right: %2$s; } '; wp_add_inline_style( 'amanda-style', sprintf( $css, $margin, $gutter ) ); } add_action( 'wp_enqueue_scripts', 'amanda_gutter_css', 11 ); endif; /* Add custom style */ if ( ! function_exists( 'amanda_post_title_size' ) ) : /** * Adds customized CSS styles with theme option variables * * @since Amanda 1.0 */ function amanda_post_title_size() { global $wp_styles; /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ // if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) // wp_enqueue_script( 'comment-reply' ); $post_title_size = pogo_get_option('post_title_size', '19px'); $header_text_size = pogo_get_option('header_text_size', '26px'); $css = ' /* custom gutter */ .blog.boxed .post-title { font-size: %1$s; } .header-text { font-size: %2$s; } '; wp_add_inline_style( 'amanda-style', sprintf( $css, $post_title_size, $header_text_size ) ); } add_action( 'wp_enqueue_scripts', 'amanda_post_title_size', 11 ); endif; /* Add custom style */ if ( ! function_exists( 'amanda_fonts_css' ) ) : /** * Adds customized CSS styles with theme option variables * * @since Amanda 1.0 */ function amanda_fonts_css() { global $wp_styles; global $font_defaults; $body_font = pogo_get_option('body_font', $font_defaults['body_font'] ); $heading_font = pogo_get_option('heading_font', $font_defaults['heading_font']); $css = ' /* Font settings */ h1, h2, h3, h4, h5, h6 { font-family: "'. $heading_font['face'] .'"; font-weight: '. $heading_font['weight'] .'; text-transform: '. $heading_font['transform'] .'; } body { font-family: "'. $body_font['face'] .'"; font-size: '. $body_font['size'] .'; line-height: '. $body_font['height'] .'; text-transform: '. $body_font['transform'] .'; } .header-text, .milestone .subject, .caption.font1 { font-family: "'. $heading_font['face'] .'"; } .caption.font2 { font-family: "'. $body_font['face'] .'"; } '; wp_add_inline_style( 'amanda-style', sprintf($css) ); add_action('wp_head', 'amanda_webfont_links'); } add_action( 'wp_enqueue_scripts', 'amanda_fonts_css', 11 ); endif; // amanda_fonts_css if( ! function_exists( 'amanda_webfont_links' ) ) : function amanda_webfont_links(){ global $font_defaults; // $websafefonts = array('Garamond', 'Impact', 'Charcoal', 'sans-serif', 'Palatino Linotype', 'Book Antiqua', 'Palatino', 'serif' , 'Tahoma', 'Geneva', 'Century Gothic', 'Lucida Sans Unicode', 'Lucida Grande', 'Arial Black', 'Times New Roman', 'Arial Narrow', 'Verdana', 'Copperplate', 'Copperplate Gothic Light', 'Lucida Console', 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', 'Helvetica', 'Courier New', 'Arial', 'Georgia'); $strFont = ""; $body_font_options = pogo_get_option('body_font', $font_defaults['body_font']); $strFont = $body_font_options['face']; // .":".$font_options['style'] $heading_font_options = pogo_get_option('heading_font', $font_defaults['heading_font']); $strFont .= '|'.$heading_font_options['face']; ?> fonts = $this->get_fonts('all'); parent::__construct( $manager, $id, $args ); } /** * Render the content of the category dropdown * * @return HTML */ public function render_content() { if(!empty($this->fonts)) { ?> get_contents($fontFile); $content = json_decode($f); } else { $googleApi = 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyC6hG3KFFylHXK66DenbPlZuVkVKyFOfq0'; $fontContent = wp_remote_get( $googleApi, array('sslverify' => false) ); if ( ! $wp_filesystem->put_contents( $fontFile, $fontContent['body'], 0644) ) { echo "There was an error saving the file.";die; } $content = json_decode($fontContent['body']); } if($amount == 'all') { return $content->items; } else { return array_slice($content->items, 0, $amount); } } } /** * Class to create a custom tags control */ class Text_Editor_Custom_Control extends WP_Customize_Control { /** * Render the content on the theme customizer page */ public function render_content() { ?>