is_rtl(), ); wp_localize_script( 'blossom-pinit', 'blossom_pinit_data', $array ); } add_action( 'wp_enqueue_scripts', 'blossom_pinit_styles', 10 ); //Remove a function from the parent theme function blossom_pinit_remove_parent_filters(){ //Have to do it after theme setup, because child theme functions are loaded first remove_action( 'customize_register', 'blossom_pin_customizer_theme_info' ); remove_action( 'customize_register', 'blossom_pin_customize_register_color' ); remove_action( 'customize_register', 'blossom_pin_customize_register_appearance' ); } add_action( 'init', 'blossom_pinit_remove_parent_filters' ); function blossom_pinit_customizer_register( $wp_customize ) { $wp_customize->add_section( 'theme_info', array( 'title' => __( 'Demo & Documentation' , 'blossom-pinit' ), 'priority' => 6, ) ); /** Important Links */ $wp_customize->add_setting( 'theme_info_theme', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $theme_info = '

'; $theme_info .= sprintf( __( 'Demo Link: %1$sClick here.%2$s', 'blossom-pinit' ), '', '' ); $theme_info .= '

'; $theme_info .= sprintf( __( 'Documentation Link: %1$sClick here.%2$s', 'blossom-pinit' ), '', '' ); $theme_info .= '

'; $wp_customize->add_control( new Blossom_Pin_Note_Control( $wp_customize, 'theme_info_theme', array( 'section' => 'theme_info', 'description' => $theme_info ) ) ); /** Primary Color*/ $wp_customize->add_setting( 'primary_color', array( 'default' => '#ea3c53', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __( 'Primary Color', 'blossom-pinit' ), 'description' => __( 'Primary color of the theme.', 'blossom-pinit' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Appearance Settings */ $wp_customize->add_panel( 'appearance_settings', array( 'priority' => 50, 'capability' => 'edit_theme_options', 'title' => __( 'Appearance Settings', 'blossom-pinit' ), 'description' => __( 'Customize Typography & Background Image', 'blossom-pinit' ), ) ); /** Typography */ $wp_customize->add_section( 'typography_settings', array( 'title' => __( 'Typography', 'blossom-pinit' ), 'priority' => 15, 'panel' => 'appearance_settings', ) ); /** Primary Font */ $wp_customize->add_setting( 'primary_font', array( 'default' => 'Muli', 'sanitize_callback' => 'blossom_pin_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Pin_Select_Control( $wp_customize, 'primary_font', array( 'label' => __( 'Primary Font', 'blossom-pinit' ), 'description' => __( 'Primary font of the site.', 'blossom-pinit' ), 'section' => 'typography_settings', 'choices' => blossom_pin_get_all_fonts(), ) ) ); /** Secondary Font */ $wp_customize->add_setting( 'secondary_font', array( 'default' => 'EB Garamond', 'sanitize_callback' => 'blossom_pin_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Pin_Select_Control( $wp_customize, 'secondary_font', array( 'label' => __( 'Secondary Font', 'blossom-pinit' ), 'description' => __( 'Secondary font of the site.', 'blossom-pinit' ), 'section' => 'typography_settings', 'choices' => blossom_pin_get_all_fonts(), ) ) ); /** Font Size*/ $wp_customize->add_setting( 'font_size', array( 'default' => 18, 'sanitize_callback' => 'blossom_pin_sanitize_number_absint' ) ); $wp_customize->add_control( new Blossom_Pin_Slider_Control( $wp_customize, 'font_size', array( 'section' => 'typography_settings', 'label' => __( 'Font Size', 'blossom-pinit' ), 'description' => __( 'Change the font size of your site.', 'blossom-pinit' ), 'choices' => array( 'min' => 10, 'max' => 50, 'step' => 1, ) ) ) ); /** Move Background Image section to appearance panel */ $wp_customize->get_section( 'background_image' )->panel = 'appearance_settings'; $wp_customize->get_section( 'background_image' )->priority = 10; /** Blog Layout */ $wp_customize->add_section( 'header_layout', array( 'title' => __( 'Header Layout', 'blossom-pinit' ), 'panel' => 'layout_settings', 'priority' => 10, ) ); /** Blog Page layout */ $wp_customize->add_setting( 'header_layout_option', array( 'default' => 'two', 'sanitize_callback' => 'blossom_pin_sanitize_radio' ) ); $wp_customize->add_control( new Blossom_Pin_Radio_Image_Control( $wp_customize, 'header_layout_option', array( 'section' => 'header_layout', 'label' => __( 'Header Layout', 'blossom-pinit' ), 'description' => __( 'it is the layout for header.', 'blossom-pinit' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/header/one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/header/two.jpg', ) ) ) ); /** Slider Layout Settings */ $wp_customize->add_section( 'slider_layout_settings', array( 'title' => __( 'Slider Layout', 'blossom-pinit' ), 'priority' => 20, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'slider_layout', array( 'default' => 'two', 'sanitize_callback' => 'blossom_pin_sanitize_radio' ) ); $wp_customize->add_control( new Blossom_Pin_Radio_Image_Control( $wp_customize, 'slider_layout', array( 'section' => 'slider_layout_settings', 'label' => __( 'Slider Layout', 'blossom-pinit' ), 'description' => __( 'Choose the layout of the slider for your site.', 'blossom-pinit' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/slider/one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/slider/two.jpg', ) ) ) ); } add_action( 'customize_register', 'blossom_pinit_customizer_register', 40 ); function blossom_pin_header(){ $header_layout = get_theme_mod( 'header_layout_option', 'two' ); ?>
'; blossom_pin_social_links( true, false ); } ?>
'; } ?> 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => true ); if( $slider_type === 'cat' && $slider_cat ){ $args['cat'] = $slider_cat; $args['posts_per_page'] = -1; }else{ $args['posts_per_page'] = $posts_per_page; } $qry = new WP_Query( $args ); if( $qry->have_posts() ){ ?> 'Cormorant Garamond', 'variant'=>'regular' ) ); $ig_site_title_font = blossom_pin_is_google_font( $site_title_font['font-family'] ); /* Translators: If there are characters in your language that are not * supported by respective fonts, translate this to 'off'. Do not translate * into your own language. */ $primary = _x( 'on', 'Primary Font: on or off', 'blossom-pinit' ); $secondary = _x( 'on', 'Secondary Font: on or off', 'blossom-pinit' ); $site_title = _x( 'on', 'Site Title Font: on or off', 'blossom-pinit' ); if ( 'off' !== $primary || 'off' !== $secondary || 'off' !== $site_title ) { $font_families = array(); if ( 'off' !== $primary && $ig_primary_font ) { $primary_variant = blossom_pin_check_varient( $primary_font, 'regular', true ); if( $primary_variant ){ $primary_var = ':' . $primary_variant; }else{ $primary_var = ''; } $font_families[] = $primary_font . $primary_var; } if ( 'off' !== $secondary && $ig_secondary_font ) { $secondary_variant = blossom_pin_check_varient( $secondary_font, 'regular', true ); if( $secondary_variant ){ $secondary_var = ':' . $secondary_variant; }else{ $secondary_var = ''; } $font_families[] = $secondary_font . $secondary_var; } if ( 'off' !== $site_title && $ig_site_title_font ) { if( ! empty( $site_title_font['variant'] ) ){ $site_title_var = ':' . blossom_pin_check_varient( $site_title_font['font-family'], $site_title_font['variant'] ); }else{ $site_title_var = ''; } $font_families[] = $site_title_font['font-family'] . $site_title_var; } $font_families = array_diff( array_unique( $font_families ), array('') ); $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** Dynamic CSS */ function blossom_pin_dynamic_css(){ $primary_font = get_theme_mod( 'primary_font', 'Muli' ); $primary_fonts = blossom_pin_get_fonts( $primary_font, 'regular' ); $secondary_font = get_theme_mod( 'secondary_font', 'EB Garamond' ); $secondary_fonts = blossom_pin_get_fonts( $secondary_font, 'regular' ); $font_size = get_theme_mod( 'font_size', 18 ); $site_title_font = get_theme_mod( 'site_title_font', array( 'font-family'=>'Cormorant Garamond', 'variant'=>'regular' ) ); $site_title_fonts = blossom_pin_get_fonts( $site_title_font['font-family'], $site_title_font['variant'] ); $primary_color = get_theme_mod( 'primary_color', '#ea3c53' ); $rgb = blossom_pin_hex2rgb( blossom_pin_sanitize_hex_color( $primary_color ) ); echo ""; } function blossom_pin_footer_bottom(){ ?>