str_replace('|', '%7C','Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i'), 'subset' => 'latin,latin-ext' ); wp_deregister_style('google-fonts'); wp_enqueue_style('google-fonts', add_query_arg ( $googleFontsArgs, "https://fonts.googleapis.com/css" ), array(), '1.0.0' ); } add_action( 'wp_enqueue_scripts', 'allegro_enqueue_scripts', 999); } /*-----------------------------------------------------------------------------------*/ /* Replace hooks */ /*-----------------------------------------------------------------------------------*/ if (!function_exists('allegro_replace_hooks')) { function allegro_replace_hooks() { remove_action( 'avventura_lite_top_sidebar', 'avventura_lite_top_sidebar_function' ); remove_action( 'avventura_lite_header_sidebar', 'avventura_lite_header_sidebar_function' ); remove_action( 'avventura_lite_slick_slider', 'avventura_lite_slick_slider_function', 10, 2); remove_action( 'avventura_lite_thumbnail', 'avventura_lite_thumbnail_function'); remove_action( 'avventura_lite_before_content', 'avventura_lite_before_content_function' ); remove_action( 'avventura_lite_default_format', 'avventura_lite_default_format_function' ); remove_action( 'avventura_lite_image_format', 'avventura_lite_image_format_function' ); remove_action( 'avventura_lite_page_format', 'avventura_lite_page_format_function' ); } add_action('init','allegro_replace_hooks'); } /*-----------------------------------------------------------------------------------*/ /* Customize register */ /*-----------------------------------------------------------------------------------*/ if (!function_exists('allegro_customize_register')) { function allegro_customize_register( $wp_customize ) { $wp_customize->remove_section( 'slideshow_section'); $wp_customize->remove_control( 'avventura_lite_header_layout'); $wp_customize->remove_control( 'avventura_lite_homepage_slideshow'); $wp_customize->remove_control( 'avventura_lite_slideshow_limit'); $wp_customize->remove_control( 'avventura_lite_homepage_slideshow_position'); $wp_customize->remove_control( 'avventura_lite_slideshow_post_category'); $wp_customize->remove_control( 'avventura_lite_slideshow_post_details'); $wp_customize->remove_control( 'avventura_lite_slideshow_overlay'); $wp_customize->remove_control( 'avventura_lite_post_icon'); $wp_customize->add_control( 'avventura_lite_post_icon' , array( 'type' => 'select', 'section' => 'settings_section', 'label' => esc_html__('Post Icon', 'allegro'), 'description' => esc_html__('Do you want to display the post icon?', 'allegro'), 'choices' => array ( 'off' => esc_html__( 'No', 'allegro'), 'on' => esc_html__( 'Yes', 'allegro'), ), )); $wp_customize->add_section('allegro_featured_area_section', array( 'title' => esc_html__( 'Featured area section', 'allegro' ), 'panel' => 'general_panel', 'priority' => 13, )); $wp_customize->add_setting( 'allegro_featured_area', array( 'default' => 'on', 'sanitize_callback' => 'allegro_select_sanitize', )); $wp_customize->add_control( 'allegro_featured_area' , array( 'type' => 'select', 'priority' => '09', 'section' => 'allegro_featured_area_section', 'label' => esc_html__('Sticky post grid','allegro'), 'description' => esc_html__('Do you want to enable the featured area section on homepage?.','allegro'), 'choices' => array ( 'off' => esc_html__( 'No','allegro'), 'on' => esc_html__( 'Yes','allegro'), ), )); function allegro_select_sanitize ($value, $setting) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $value, $control->choices ) ) { return $value; } else { return $setting->default; } } } add_action( 'customize_register', 'allegro_customize_register', 11 ); } /*-----------------------------------------------------------------------------------*/ /* Theme setup */ /*-----------------------------------------------------------------------------------*/ if (!function_exists('allegro_theme_setup')) { function allegro_theme_setup() { load_child_theme_textdomain( 'allegro', get_stylesheet_directory() . '/languages' ); require_once( trailingslashit( get_stylesheet_directory() ) . 'core/functions/function-style.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/post-formats/default-format.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/post-formats/image-format.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/post-formats/page-format.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/sidebars/top-sidebar.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/sidebars/header-sidebar.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/templates/before-content.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/templates/media.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/templates/slick-slider.php' ); require_once( trailingslashit( get_stylesheet_directory() ) . '/core/templates/featured-posts.php' ); remove_theme_support( 'custom-logo'); $defaults = array( 'header-text' => array( 'site-title', 'site-description' )); add_theme_support( 'custom-logo', $defaults ); remove_image_size( 'avventura_lite_slick_large', 960, 600, TRUE ); remove_image_size( 'avventura_lite_slick_small', 400, 400, TRUE ); add_image_size( 'allegro_slick_large', 560, 371, TRUE ); } add_action( 'after_setup_theme', 'allegro_theme_setup', 999); } /*-----------------------------------------------------------------------------------*/ /* Exclude featured posts on homepage */ /*-----------------------------------------------------------------------------------*/ if (!function_exists('allegro_exclude_featured_posts')) { function allegro_exclude_featured_posts($query) { if ( $query->is_home() && $query->is_main_query() && avventura_lite_setting('allegro_featured_area', 'on') == 'on' ) { $query->set('offset', 6); } } add_action('pre_get_posts', 'allegro_exclude_featured_posts'); } /*-----------------------------------------------------------------------------------*/ /* Widgets init */ /*-----------------------------------------------------------------------------------*/ if (!function_exists('allegro_widgets_init')) { function allegro_widgets_init() { register_sidebar(array( 'name' => esc_html__('Banner widget area','allegro'), 'id' => 'allegro-banner-widget-area', 'description' => esc_html__('This widget area will be shown near the logo (Recommended for the image widget).', 'allegro'), 'before_widget' => '