is_rtl(), ); wp_localize_script( 'blossom-mommy-blog', 'blossom_mommy_blog_data', $array ); } endif; add_action( 'wp_enqueue_scripts', 'blossom_mommy_blog_scripts', 10 ); //Remove a function from the parent theme function remove_parent_filters(){ //Have to do it after theme setup, because child theme functions are loaded first remove_action( 'customize_register', 'blossom_feminine_customizer_theme_info' ); } add_action( 'init', 'remove_parent_filters' ); /** * Blossom Mommy Blog Body Classes */ function blossom_feminine_body_classes( $classes ){ $home_layout_option = get_theme_mod( 'home_layout_option', 'two' ); // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } // Adds a class of custom-background-image to sites with a custom background image. if ( get_background_image() ) { $classes[] = 'custom-background-image custom-background'; } // Adds a class of custom-background-color to sites with a custom background color. if ( get_background_color() != 'ffffff' ) { $classes[] = 'custom-background-color custom-background'; } if( is_search() && ! is_post_type_archive( 'product' ) ){ $classes[] = 'search-result-page'; } $classes[] = blossom_feminine_sidebar_layout(); if( $home_layout_option == 'two' ) { $classes[] = 'blog-layout-two'; } return $classes; } function blossom_mommy_blog_customize_register( $wp_customize ) { $wp_customize->get_control( 'slider_animation' )->active_callback = 'blossom_mommy_blog_slider_active_cb'; $wp_customize->add_section( 'theme_info', array( 'title' => __( 'Demo & Documentation ' , 'blossom-mommy-blog' ), 'priority' => 6, ) ); /** Important Links */ $wp_customize->add_setting( 'theme_info_link', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $theme_info = '
'; $theme_info .= sprintf( __( '%1$sDemo Link:%2$s %3$sClick here.%4$s', 'blossom-mommy-blog' ), '', '' , '', '' ); $theme_info .= '
'; $theme_info .= sprintf( __( '%1$sDocumentation Link:%2$s %3$sClick here.%4$s', 'blossom-mommy-blog' ), '', '' , '', '' ); $theme_info .= '
'; $wp_customize->add_control( new Blossom_Feminine_Note_Control( $wp_customize, 'theme_info_link', array( 'section' => 'theme_info', 'description' => $theme_info, ) ) ); /** Typography */ $wp_customize->add_section( 'typography_settings', array( 'title' => __( 'Typography', 'blossom-mommy-blog' ), 'priority' => 10, 'panel' => 'appearance_settings', ) ); /** Primary Font */ $wp_customize->add_setting( 'primary_font', array( 'default' => 'Cabin', 'sanitize_callback' => 'blossom_feminine_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Feminine_Select_Control( $wp_customize, 'primary_font', array( 'label' => __( 'Primary Font', 'blossom-mommy-blog' ), 'description' => __( 'Primary font of the site.', 'blossom-mommy-blog' ), 'section' => 'typography_settings', 'choices' => blossom_feminine_get_all_fonts(), ) ) ); /** Secondary Font */ $wp_customize->add_setting( 'secondary_font', array( 'default' => 'EB Garamond', 'sanitize_callback' => 'blossom_feminine_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Feminine_Select_Control( $wp_customize, 'secondary_font', array( 'label' => __( 'Secondary Font', 'blossom-mommy-blog' ), 'description' => __( 'Secondary font of the site.', 'blossom-mommy-blog' ), 'section' => 'typography_settings', 'choices' => blossom_feminine_get_all_fonts(), ) ) ); /** Font Size*/ $wp_customize->add_setting( 'font_size', array( 'default' => 18, 'sanitize_callback' => 'blossom_feminine_sanitize_number_absint' ) ); $wp_customize->add_control( new Blossom_Feminine_Slider_Control( $wp_customize, 'font_size', array( 'section' => 'typography_settings', 'label' => __( 'Font Size', 'blossom-mommy-blog' ), 'description' => __( 'Change the font size of your site.', 'blossom-mommy-blog' ), 'choices' => array( 'min' => 10, 'max' => 50, 'step' => 1, ) ) ) ); /** Primary Color*/ $wp_customize->add_setting( 'primary_color', array( 'default' => '#78c0a8', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __( 'Primary Color', 'blossom-mommy-blog' ), 'description' => __( 'Primary color of the theme.', 'blossom-mommy-blog' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Layout Settings */ $wp_customize->add_panel( 'layout_settings', array( 'title' => 'Layout Settings', 'priority' => 45, ) ); /** Slider Layout **/ $wp_customize->add_section( 'slider_layout_settings', array( 'title' => __( 'Slider Layout', 'blossom-mommy-blog' ), 'panel' => 'layout_settings', 'priority' => 15, ) ); $wp_customize->add_setting( 'slider_layout_option', array( 'default' => 'two', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Blossom_Feminine_Radio_Image_Control( $wp_customize, 'slider_layout_option', array( 'section' => 'slider_layout_settings', 'label' => __( 'Slider Layouts', 'blossom-mommy-blog' ), 'description' => __( 'This is the slider layouts for your blog.', 'blossom-mommy-blog' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/slider/slider-one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/slider/slider-two.jpg', ) ) ) ); /** Home Page Layout **/ $wp_customize->add_section( 'homepage_layout', array( 'title' => __( 'Home Page Layout', 'blossom-mommy-blog' ), 'panel' => 'layout_settings', 'priority' => 20, ) ); $wp_customize->add_setting( 'home_layout_option', array( 'default' => 'two', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Blossom_Feminine_Radio_Image_Control( $wp_customize, 'home_layout_option', array( 'section' => 'homepage_layout', 'label' => __( 'Home Page Layouts', 'blossom-mommy-blog' ), 'description' => __( 'This is the layout for blog index page.', 'blossom-mommy-blog' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/home/home-one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/home/home-two.jpg', ) ) ) ); } add_action( 'customize_register', 'blossom_mommy_blog_customize_register', 40 ); /** * Blossom Mommy Blog Banner Section */ function blossom_feminine_banner(){ $ed_slider = get_theme_mod( 'ed_slider', true ); $slider_layout = get_theme_mod( 'slider_layout_option', 'two' ); $text = ( $slider_layout == 'two' ) ? 'text-holder' : 'banner-text'; $item = ( $slider_layout == 'two' ) ? 'grid-item' : 'item'; if( ( is_front_page() || is_home() ) && $ed_slider ){ $slider_type = get_theme_mod( 'slider_type', 'latest_posts' ); $slider_cat = get_theme_mod( 'slider_cat' ); $posts_per_page = get_theme_mod( 'no_of_slides', 3 ); $args = array( 'post_type' => '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() ){ ?> ' . $categories_list . ''; } } } /** Blossom Feminine Post Thumbnail */ function blossom_feminine_post_thumbnail(){ $image_size = 'thumbnail'; $ed_featured = get_theme_mod( 'ed_featured_image', true ); $home_layout_option = get_theme_mod( 'home_layout_option', 'two' ); $sidebar_layout = blossom_feminine_sidebar_layout(); if( is_front_page() || is_home() ){ echo ''; }elseif( is_archive() || is_search() ){ echo ''; if( has_post_thumbnail() ){ the_post_thumbnail( 'blossom-feminine-cat' ); }else{ echo '
';
}
echo '';
}elseif( is_singular() ){
echo '