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' ); add_theme_support( 'responsive-embeds' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'arrival' ), 'top' => esc_html__( 'Top', 'arrival' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'arrival_custom_background_args', array( 'default-color' => 'f1f1f1', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => false, 'flex-height' => false, ) ); /** * Add support for default block styles. * * @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#default-block-styles */ add_theme_support( 'wp-block-styles' ); /** * Add support for wide aligments. * * @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#wide-alignment */ add_theme_support( 'align-wide' ); /** * Add support for block color palettes. * * @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#block-color-palettes */ add_theme_support( 'editor-color-palette', array( array( 'name' => __( 'Dusty orange', 'arrival' ), 'slug' => 'dusty-orange', 'color' => '#ed8f5b', ), array( 'name' => __( 'Dusty red', 'arrival' ), 'slug' => 'dusty-red', 'color' => '#e36d60', ), array( 'name' => __( 'Dusty wine', 'arrival' ), 'slug' => 'dusty-wine', 'color' => '#9c4368', ), array( 'name' => __( 'Dark sunset', 'arrival' ), 'slug' => 'dark-sunset', 'color' => '#33223b', ), array( 'name' => __( 'Almost black', 'arrival' ), 'slug' => 'almost-black', 'color' => '#0a1c28', ), array( 'name' => __( 'Dusty water', 'arrival' ), 'slug' => 'dusty-water', 'color' => '#41848f', ), array( 'name' => __( 'Dusty sky', 'arrival' ), 'slug' => 'dusty-sky', 'color' => '#72a7a3', ), array( 'name' => __( 'Dusty daylight', 'arrival' ), 'slug' => 'dusty-daylight', 'color' => '#97c0b7', ), array( 'name' => __( 'Dusty sun', 'arrival' ), 'slug' => 'dusty-sun', 'color' => '#eee9d1', ), ) ); /** * Optional: Disable custom colors in block color palettes. * * @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/ * * add_theme_support( 'disable-custom-colors' ); */ /** * Add support for font sizes. * * @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#block-font-sizes */ add_theme_support( 'editor-font-sizes', array( array( 'name' => __( 'small', 'arrival' ), 'shortName' => __( 'S', 'arrival' ), 'size' => 16, 'slug' => 'small', ), array( 'name' => __( 'regular', 'arrival' ), 'shortName' => __( 'M', 'arrival' ), 'size' => 20, 'slug' => 'regular', ), array( 'name' => __( 'large', 'arrival' ), 'shortName' => __( 'L', 'arrival' ), 'size' => 36, 'slug' => 'large', ), array( 'name' => __( 'larger', 'arrival' ), 'shortName' => __( 'XL', 'arrival' ), 'size' => 48, 'slug' => 'larger', ), ) ); } add_action( 'after_setup_theme', 'arrival_setup' ); /** * Set the embed width in pixels, based on the theme's design and stylesheet. * * @param array $dimensions An array of embed width and height values in pixels (in that order). * @return array */ function arrival_embed_dimensions( array $dimensions ) { $dimensions['width'] = 720; return $dimensions; } add_filter( 'embed_defaults', 'arrival_embed_dimensions' ); /** * Register Google Fonts */ function arrival_fonts_url() { $fonts_url = ''; /** * Translator: If Roboto Sans does not support characters in your language, translate this to 'off'. */ $roboto_cond = esc_html_x( 'on', 'Roboto Condensed font: on or off', 'arrival' ); /** * Translator: If Crimson Text does not support characters in your language, translate this to 'off'. */ $roboto = esc_html_x( 'on', 'Roboto font: on or off', 'arrival' ); $font_families = array(); if ( 'off' !== $roboto_cond ) { $font_families[] = 'Roboto Condensed:400,400i,700,700i'; } if ( 'off' !== $roboto ) { $font_families[] = 'Roboto:400,500,700'; } if ( in_array( 'on', array( $roboto_cond, $roboto ) ) ) { $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Add preconnect for Google Fonts. * * @since Twenty Seventeen 1.0 * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed. * @return array $urls URLs to print for resource hints. */ function arrival_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'arrival-fonts', 'queue' ) && 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter( 'wp_resource_hints', 'arrival_resource_hints', 10, 2 ); /** * Enqueue WordPress theme styles within Gutenberg. */ function arrival_gutenberg_styles() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'arrival-fonts', arrival_fonts_url(), array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion // Enqueue main stylesheet. wp_enqueue_style( 'arrival-base-style', get_theme_file_uri( '/css/editor-styles.css' ), array(), '20180514' ); } add_action( 'enqueue_block_editor_assets', 'arrival_gutenberg_styles' ); /** Adding Editor Styles **/ function arrival_add_editor_styles() { add_editor_style( get_template_directory_uri().'/css/editor-style.css' ); } add_action( 'admin_init', 'arrival_add_editor_styles' ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function arrival_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'arrival' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'arrival' ), 'before_widget' => '', 'before_title' => '