tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1568, 9999 ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'menu-1' => __( 'Primary', 'varia' ), 'menu-2' => __( 'Footer Menu', 'varia' ), 'social' => __( 'Social Links Menu', 'varia' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 96, 'width' => 100, 'flex-width' => true, 'flex-height' => false, 'header-text' => array( 'site-title', 'site-description' ), ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Add support for Block Styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); // Enqueue editor styles. add_editor_style( 'style-editor.css' ); // add_editor_style( 'child-theme-alt-style.css' ); // this will get loaded in a child theme // Add custom editor font sizes. add_theme_support( 'editor-font-sizes', array( array( 'name' => __( 'Small', 'varia' ), 'shortName' => __( 'S', 'varia' ), 'size' => 15, 'slug' => 'small', ), array( 'name' => __( 'Normal', 'varia' ), 'shortName' => __( 'M', 'varia' ), 'size' => 18, 'slug' => 'normal', ), array( 'name' => __( 'Large', 'varia' ), 'shortName' => __( 'L', 'varia' ), 'size' => 25.92, 'slug' => 'large', ), array( 'name' => __( 'Huge', 'varia' ), 'shortName' => __( 'XL', 'varia' ), 'size' => 31.105, 'slug' => 'huge', ), ) ); // $default_hue = varia_get_default_hue(); // $saturation = varia_get_default_saturation(); // $lightness = varia_get_default_lightness(); // $lightness_hover = varia_get_default_lightness_hover(); // Editor color palette. add_theme_support( 'editor-color-palette', array( array( 'name' => __( 'Primary', 'varia' ), 'slug' => 'primary', 'color' => '#0000FF', // varia_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? $default_hue : get_theme_mod( 'primary_color_hue', $default_hue ), $saturation, $lightness ), ), array( 'name' => __( 'Secondary', 'varia' ), 'slug' => 'secondary', 'color' => '#FF0000', // varia_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? $default_hue : get_theme_mod( 'primary_color_hue', $default_hue ), $saturation, $lightness_hover ), ), array( 'name' => __( 'Dark Gray', 'varia' ), 'slug' => 'foreground-dark', 'color' => '#111111', ), array( 'name' => __( 'Gray', 'varia' ), 'slug' => 'foreground', 'color' => '#444444', ), array( 'name' => __( 'Light Gray', 'varia' ), 'slug' => 'foreground-light', 'color' => '#767676', ), array( 'name' => __( 'Lighter Gray', 'varia' ), 'slug' => 'background-dark', 'color' => '#DDDDDD', ), array( 'name' => __( 'Subtle Gray', 'varia' ), 'slug' => 'background-light', 'color' => '#FAFAFA', ), array( 'name' => __( 'White', 'varia' ), 'slug' => 'background', 'color' => '#FFFFFF', ), ) ); // Add support for responsive embedded content. add_theme_support( 'responsive-embeds' ); add_theme_support( 'navigation-menu-block', array( 'template_path' => get_template_directory() . '/inc/navigation-menu-block.php', 'method' => 'varia_get_navigation_menu_block' ) ); } endif; add_action( 'after_setup_theme', 'varia_setup' ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function varia_widgets_init() { register_sidebar( array( 'name' => __( 'Footer', 'varia' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your footer.', 'varia' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'varia_widgets_init' ); /** * 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 Content width. */ function varia_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'varia_content_width', 750 ); } add_action( 'after_setup_theme', 'varia_content_width', 0 ); /** * Enqueue scripts and styles. */ function varia_scripts() { // Theme styles wp_enqueue_style( 'varia-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) ); // RTL styles wp_style_add_data( 'varia-style', 'rtl', 'replace' ); // Print styles wp_enqueue_style( 'varia-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); // Threaded comment reply styles if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'varia_scripts' ); /** * Fix skip link focus in IE11. * * This does not enqueue the script because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * @link https://git.io/vWdr2 */ function varia_skip_link_focus_fix() { // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`. ?> get( 'Version' ), 'all' ); } add_action( 'enqueue_block_editor_assets', 'varia_editor_content_width' ); /** * SVG Icons class. */ require get_template_directory() . '/classes/class-varia-svg-icons.php'; /** * Custom Comment Walker template. */ require get_template_directory() . '/classes/class-varia-walker-comment.php'; /** * Enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * SVG Icons related functions. */ require get_template_directory() . '/inc/icon-functions.php'; /** * Custom template tags for the theme. */ require get_template_directory() . '/inc/template-tags.php';