'ffffff' ) ) ); // Set up the WordPress core custom logo feature. add_theme_support( 'custom-logo', apply_filters( 'gridbox_custom_logo_args', array( 'height' => 40, 'width' => 200, 'flex-height' => true, 'flex-width' => true, ) ) ); // Set up the WordPress core custom header feature. add_theme_support( 'custom-header', apply_filters( 'gridbox_custom_header_args', array( 'header-text' => false, 'width' => 1920, 'height' => 480, 'flex-height' => true, ) ) ); // Add Theme Support for wooCommerce. add_theme_support( 'woocommerce' ); // Add extra theme styling to the visual editor. add_editor_style( array( 'assets/css/editor-style.css' ) ); // Add Theme Support for Selective Refresh in Customizer. add_theme_support( 'customize-selective-refresh-widgets' ); // Add support for responsive embed blocks. add_theme_support( 'responsive-embeds' ); } endif; add_action( 'after_setup_theme', 'gridbox_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function gridbox_content_width() { $GLOBALS['content_width'] = apply_filters( 'gridbox_content_width', 780 ); } add_action( 'after_setup_theme', 'gridbox_content_width', 0 ); /** * Register widget areas and custom widgets. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function gridbox_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'gridbox' ), 'id' => 'sidebar', 'description' => esc_html__( 'Appears on single posts and pages.', 'gridbox' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Magazine Homepage', 'gridbox' ), 'id' => 'magazine-homepage', 'description' => esc_html__( 'Appears on blog index and Magazine Homepage template. You can use the Magazine widgets here.', 'gridbox' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'gridbox_widgets_init' ); /** * Enqueue scripts and styles. */ function gridbox_scripts() { // Get theme options from database. $theme_options = gridbox_theme_options(); // Get Theme Version. $theme_version = wp_get_theme()->get( 'Version' ); // Register and Enqueue Stylesheet. wp_enqueue_style( 'gridbox-stylesheet', get_stylesheet_uri(), array(), $theme_version ); // Register and Enqueue Safari Flexbox CSS fixes. wp_enqueue_style( 'gridbox-safari-flexbox-fixes', get_template_directory_uri() . '/assets/css/safari-flexbox-fixes.css', array(), '20200420' ); // Register and Enqueue HTML5shiv to support HTML5 elements in older IE versions. wp_enqueue_script( 'html5shiv', get_template_directory_uri() . '/assets/js/html5shiv.min.js', array(), '3.7.3' ); wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' ); // Register and enqueue navigation.min.js. if ( ( has_nav_menu( 'primary' ) || has_nav_menu( 'secondary' ) ) && ! gridbox_is_amp() ) { wp_enqueue_script( 'gridbox-navigation', get_theme_file_uri( '/assets/js/navigation.min.js' ), array(), '20220224', true ); $gridbox_l10n = array( 'expand' => esc_html__( 'Expand child menu', 'gridbox' ), 'collapse' => esc_html__( 'Collapse child menu', 'gridbox' ), 'icon' => gridbox_get_svg( 'expand' ), ); wp_localize_script( 'gridbox-navigation', 'gridboxScreenReaderText', $gridbox_l10n ); } // Register and enqueue sticky-header.js. if ( true == $theme_options['sticky_header'] && ! gridbox_is_amp() ) { wp_enqueue_script( 'gridbox-jquery-sticky-header', get_template_directory_uri() . '/assets/js/sticky-header.js', array( 'jquery' ), '20200808' ); } // Enqueue svgxuse to support external SVG Sprites in Internet Explorer. if ( ! gridbox_is_amp() ) { wp_enqueue_script( 'svgxuse', get_theme_file_uri( '/assets/js/svgxuse.min.js' ), array(), '1.2.6' ); } // Register Comment Reply Script for Threaded Comments. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'gridbox_scripts' ); /** * Enqueue theme fonts. */ function gridbox_theme_fonts() { $fonts_url = gridbox_get_fonts_url(); // Load Fonts if necessary. if ( $fonts_url ) { require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' ); wp_enqueue_style( 'gridbox-theme-fonts', wptt_get_webfont_url( $fonts_url ), array(), '20201110' ); } } add_action( 'wp_enqueue_scripts', 'gridbox_theme_fonts', 1 ); add_action( 'enqueue_block_editor_assets', 'gridbox_theme_fonts', 1 ); /** * Retrieve webfont URL to load fonts locally. */ function gridbox_get_fonts_url() { $font_families = array( 'Roboto:400,400italic,700,700italic', 'Roboto Slab:400,400italic,700,700italic', ); $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), 'display' => urlencode( 'swap' ), ); return apply_filters( 'gridbox_get_fonts_url', add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ) ); } /** * Make custom image sizes available in Gutenberg. */ function gridbox_add_image_size_names( $sizes ) { return array_merge( $sizes, array( 'post-thumbnail' => esc_html__( 'Gridbox Single Post', 'gridbox' ), ) ); } add_filter( 'image_size_names_choose', 'gridbox_add_image_size_names' ); /** * Include Files */ // Include Theme Info page. require get_template_directory() . '/inc/theme-info.php'; // Include Theme Customizer Options. require get_template_directory() . '/inc/customizer/customizer.php'; require get_template_directory() . '/inc/customizer/default-options.php'; // Include SVG Icon Functions. require get_template_directory() . '/inc/icons.php'; // Include Extra Functions. require get_template_directory() . '/inc/extras.php'; // Include Template Functions. require get_template_directory() . '/inc/template-tags.php'; // Include Gutenberg Features. require get_template_directory() . '/inc/gutenberg.php'; // Include support functions for Theme Addons. require get_template_directory() . '/inc/addons.php'; // Include Magazine Functions. require get_template_directory() . '/inc/magazine.php'; // Include Widget Files. require get_template_directory() . '/inc/widgets/widget-magazine-posts-grid.php';