is_rtl(), 'loop' => (bool) get_theme_mod( 'slider_loop', true ), 'auto' => get_theme_mod( 'slider_auto', true ), ); wp_localize_script( 'cook-recipe', 'cook_recipe_data', $array ); } add_action( 'wp_enqueue_scripts', 'cook_recipe_styles', 10 ); //Remove a function from the parent theme function cook_recipe_remove_parent_filters(){ remove_action( 'customize_register', 'cookery_lite_customizer_theme_info' ); remove_action( 'customize_register', 'cookery_lite_customize_register_appearance' ); remove_action( 'wp_head', 'cookery_lite_dynamic_css', 99 ); } add_action( 'init', 'cook_recipe_remove_parent_filters' ); function cook_recipe_customizer_register( $wp_customize ) { $wp_customize->add_section( 'theme_info', array( 'title' => __( 'Information Links', 'cook-recipe' ), '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', 'cook-recipe' ), '', '' ); $theme_info .= '

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

'; $wp_customize->add_control( new Cookery_Lite_Note_Control( $wp_customize, 'theme_info_theme', array( 'section' => 'theme_info', 'description' => $theme_info ) ) ); /** Header Layout Settings */ $wp_customize->add_section( 'header_layout_settings', array( 'title' => __( 'Header Layout', 'cook-recipe' ), 'priority' => 10, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'header_layout', array( 'default' => 'two', 'sanitize_callback' => 'cookery_lite_sanitize_radio' ) ); $wp_customize->add_control( new Cookery_Lite_Radio_Image_Control( $wp_customize, 'header_layout', array( 'section' => 'header_layout_settings', 'label' => __( 'Header Layout', 'cook-recipe' ), 'description' => __( 'Choose the layout of the header for your site.', 'cook-recipe' ), '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', 'cook-recipe' ), 'priority' => 20, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'slider_layout', array( 'default' => 'four', 'sanitize_callback' => 'cookery_lite_sanitize_radio' ) ); $wp_customize->add_control( new Cookery_Lite_Radio_Image_Control( $wp_customize, 'slider_layout', array( 'section' => 'slider_layout_settings', 'label' => __( 'Slider Layout', 'cook-recipe' ), 'description' => __( 'Choose the layout of the slider for your site.', 'cook-recipe' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/slider/one.jpg', 'four' => get_stylesheet_directory_uri() . '/images/slider/four.jpg', ) ) ) ); $wp_customize->add_panel( 'appearance_settings', array( 'title' => __( 'Appearance Settings', 'cook-recipe' ), 'priority' => 25, 'capability' => 'edit_theme_options', 'description' => __( 'Change color and body background.', 'cook-recipe' ), ) ); /** Typography */ $wp_customize->add_section( 'typography_settings', array( 'title' => __( 'Typography', 'cook-recipe' ), 'priority' => 20, 'panel' => 'appearance_settings', ) ); /** Primary Font */ $wp_customize->add_setting( 'primary_font', array( 'default' => 'Bitter', 'sanitize_callback' => 'cookery_lite_sanitize_select' ) ); $wp_customize->add_control( new Cookery_Lite_Select_Control( $wp_customize, 'primary_font', array( 'label' => __( 'Primary Font', 'cook-recipe' ), 'description' => __( 'Primary font of the site.', 'cook-recipe' ), 'section' => 'typography_settings', 'choices' => cookery_lite_get_all_fonts(), ) ) ); /** Secondary Font */ $wp_customize->add_setting( 'secondary_font', array( 'default' => 'Domine', 'sanitize_callback' => 'cookery_lite_sanitize_select' ) ); $wp_customize->add_control( new Cookery_Lite_Select_Control( $wp_customize, 'secondary_font', array( 'label' => __( 'Secondary Font', 'cook-recipe' ), 'description' => __( 'Secondary font of the site.', 'cook-recipe' ), 'section' => 'typography_settings', 'choices' => cookery_lite_get_all_fonts(), ) ) ); /** Font Size*/ $wp_customize->add_setting( 'font_size', array( 'default' => 18, 'sanitize_callback' => 'cookery_lite_sanitize_number_absint' ) ); $wp_customize->add_control( new Cookery_Lite_Slider_Control( $wp_customize, 'font_size', array( 'section' => 'typography_settings', 'label' => __( 'Font Size', 'cook-recipe' ), 'description' => __( 'Change the font size of your site.', 'cook-recipe' ), 'choices' => array( 'min' => 10, 'max' => 50, 'step' => 1, ) ) ) ); $wp_customize->add_setting( 'ed_localgoogle_fonts', array( 'default' => false, 'sanitize_callback' => 'cookery_lite_sanitize_checkbox', ) ); $wp_customize->add_control( new Cookery_Lite_Toggle_Control( $wp_customize, 'ed_localgoogle_fonts', array( 'section' => 'typography_settings', 'label' => __( 'Load Google Fonts Locally', 'cook-recipe' ), 'description' => __( 'Enable to load google fonts from your own server instead from google\'s CDN. This solves privacy concerns with Google\'s CDN and their sometimes less-than-transparent policies.', 'cook-recipe' ) ) ) ); $wp_customize->add_setting( 'ed_preload_local_fonts', array( 'default' => false, 'sanitize_callback' => 'cookery_lite_sanitize_checkbox', ) ); $wp_customize->add_control( new Cookery_Lite_Toggle_Control( $wp_customize, 'ed_preload_local_fonts', array( 'section' => 'typography_settings', 'label' => __( 'Preload Local Fonts', 'cook-recipe' ), 'description' => __( 'Preloading Google fonts will speed up your website speed.', 'cook-recipe' ), 'active_callback' => 'cookery_lite_ed_localgoogle_fonts' ) ) ); ob_start(); ?> add_setting( 'ed_flush_local_fonts', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( 'ed_flush_local_fonts', array( 'label' => __( 'Flush Local Fonts Cache', 'cook-recipe' ), 'section' => 'typography_settings', 'description' => $cook_recipe_flush_button, 'type' => 'hidden', 'active_callback' => 'cookery_lite_ed_localgoogle_fonts' ) ); /** Primary Color*/ $wp_customize->add_setting( 'primary_color', array( 'default' => '#f15641', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __( 'Primary Color', 'cook-recipe' ), 'description' => __( 'Primary color of the theme.', 'cook-recipe' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Secondary Color*/ $wp_customize->add_setting( 'secondary_color', array( 'default' => '#f1ae41', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_color', array( 'label' => __( 'Secondary Color', 'cook-recipe' ), 'description' => __( 'Secondary color of the theme.', 'cook-recipe' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Move Background Image section to appearance panel */ $wp_customize->get_section( 'colors' )->panel = 'appearance_settings'; $wp_customize->get_section( 'colors' )->priority = 10; $wp_customize->get_section( 'background_image' )->panel = 'appearance_settings'; $wp_customize->get_section( 'background_image' )->priority = 15; } add_action( 'customize_register', 'cook_recipe_customizer_register', 40 ); /** * Header Start */ function cookery_lite_header(){ $ed_cart = get_theme_mod( 'ed_shopping_cart', true ); $ed_search = get_theme_mod( 'ed_header_search', true ); $header_layout = get_theme_mod( 'header_layout', 'two' ); ?> 'publish', 'ignore_sticky_posts' => true ); if( cookery_lite_is_delicious_recipe_activated() && $slider_type == 'latest_recipes' ){ $args['post_type'] = DELICIOUS_RECIPE_POST_TYPE; $args['posts_per_page'] = $posts_per_page; }elseif( $slider_type === 'cat' && $slider_cat ){ $args['post_type'] = 'post'; $args['cat'] = $slider_cat; $args['posts_per_page'] = -1; }else{ $args['post_type'] = 'post'; $args['posts_per_page'] = $posts_per_page; } $qry = new WP_Query( $args ); if( $qry->have_posts() ){ ?> '; ?> \'); }'; die(); // end ajax process. } /** * Gutenberg Dynamic Style */ function cookery_lite_gutenberg_inline_style(){ /* Get Link Color */ $primary_font = get_theme_mod( 'primary_font', 'Bitter' ); $primary_fonts = cookery_lite_get_fonts( $primary_font, 'regular' ); $secondary_font = get_theme_mod( 'secondary_font', 'Domine' ); $secondary_fonts = cookery_lite_get_fonts( $secondary_font, 'regular' ); $primary_color = get_theme_mod( 'primary_color', '#f15641' ); $secondary_color = get_theme_mod( 'secondary_color', '#f1ae41' ); $rgb = cookery_lite_hex2rgb( cookery_lite_sanitize_hex_color( $primary_color ) ); $rgb2 = cookery_lite_hex2rgb( cookery_lite_sanitize_hex_color( $secondary_color ) ); $custom_css = ':root .block-editor-page { --primary-color: ' . cookery_lite_sanitize_hex_color( $primary_color ) . '; --primary-color-rgb: ' . sprintf( '%1$s, %2$s, %3$s', $rgb[0], $rgb[1], $rgb[2] ) . '; --secondary-color: ' . cookery_lite_sanitize_hex_color( $secondary_color ) . '; --secondary-color-rgb: ' . sprintf('%1$s, %2$s, %3$s', $rgb2[0], $rgb2[1], $rgb2[2] ) . '; --primary-font: ' . esc_html( $primary_fonts['font'] ) . '; --secondary-font: ' . esc_html( $secondary_fonts['font'] ) . '; } blockquote.wp-block-quote::before { background-image: url(\'data:image/svg+xml; utf-8, \'); }'; return $custom_css; } /** * Footer Bottom */ function cookery_lite_footer_bottom(){ ?> ', '' ); echo '
'; cookery_lite_recipe_keywords(); cookery_lite_prep_time(); cookery_lite_difficulty_level(); echo '
'; }else{ cookery_lite_recipe_category(); the_title( '

', '

' ); echo '
'; if( $show_date ) cookery_lite_posted_on(); cookery_lite_comment_count(); cookery_lite_recipe_rating(); echo '
'; echo '
'; the_excerpt(); echo '
'; echo ''; } }else{ cookery_lite_category(); the_title( '

', '

' ); if( $slider_layout == 'four' ){ echo '
'; the_excerpt(); echo '
'; } if( 'post' == get_post_type() && $show_date ) : echo '
'; cookery_lite_posted_on(); echo '
'; endif; } } function cookery_lite_fonts_url(){ $fonts_url = ''; $primary_font = get_theme_mod( 'primary_font', 'Bitter' ); $ig_primary_font = cookery_lite_is_google_font( $primary_font ); $secondary_font = get_theme_mod( 'secondary_font', 'Domine' ); $ig_secondary_font = cookery_lite_is_google_font( $secondary_font ); $site_title_font = get_theme_mod( 'site_title_font', array( 'font-family'=>'Noto Serif', 'variant'=>'regular' ) ); $ig_site_title_font = cookery_lite_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', 'cook-recipe' ); $secondary = _x( 'on', 'Secondary Font: on or off', 'cook-recipe' ); $site_title = _x( 'on', 'Site Title Font: on or off', 'cook-recipe' ); if ( 'off' !== $primary || 'off' !== $secondary || 'off' !== $site_title ) { $font_families = array(); if ( 'off' !== $primary && $ig_primary_font ) { $primary_variant = cookery_lite_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 = cookery_lite_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 = ':' . cookery_lite_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' ); } if( get_theme_mod( 'ed_localgoogle_fonts', false ) ) { $fonts_url = cookery_lite_get_webfont_url( add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ) ); } return esc_url( $fonts_url ); } /** Dynamic CSS */ function cook_recipe_dynamic_css(){ $primary_font = get_theme_mod( 'primary_font', 'Bitter' ); $primary_fonts = cookery_lite_get_fonts( $primary_font, 'regular' ); $secondary_font = get_theme_mod( 'secondary_font', 'Domine' ); $secondary_fonts = cookery_lite_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'=>'Noto Serif', 'variant'=>'regular' ) ); $site_title_fonts = cookery_lite_get_fonts( $site_title_font['font-family'], $site_title_font['variant'] ); $site_title_font_size = get_theme_mod( 'site_title_font_size', 30 ); $primary_color = get_theme_mod( 'primary_color', '#f15641' ); $secondary_color = get_theme_mod( 'secondary_color', '#f1ae41' ); $logo_width = get_theme_mod( 'logo_width', 150 ); $static_cta_one_color = get_theme_mod( 'static_cta_one_color', '#ffffff' ); $enable_typography = ''; $featured_recipe_bg = get_theme_mod( 'featured_recipe_bg' ); $client_section_bg = get_theme_mod( 'client_section_bg' ); $footer_newsletter_bg = get_theme_mod( 'newsletter_section_bg' ); if( cookery_lite_is_delicious_recipe_activated() ){ $global_settings = delicious_recipes_get_global_settings(); $enable_typography = ( isset( $global_settings['enablePluginTypography']['0'] ) && 'yes' === $global_settings['enablePluginTypography']['0'] ) ? true : false; } $rgb = cookery_lite_hex2rgb( cookery_lite_sanitize_hex_color( $primary_color ) ); $rgb2 = cookery_lite_hex2rgb( cookery_lite_sanitize_hex_color( $secondary_color ) ); echo ""; } add_action( 'wp_head', 'cook_recipe_dynamic_css', 99 );