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' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'blossom-spa' ) ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'blossom_spa_custom_background_args', array( 'default-color' => 'ffffff', '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' => 70, /** change height as per theme requirement */ 'width' => 70, /** change width as per theme requirement */ 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ) ) ); /** * Add support for custom header. */ add_theme_support( 'custom-header', apply_filters( 'blossom_spa_custom_header_args', array( 'default-image' => get_template_directory_uri() . '/images/banner-img.jpg', 'video' => true, 'width' => 1920, 'height' => 700, 'header-text' => false, ) ) ); // Register default headers. register_default_headers( array( 'default-banner' => array( 'url' => '%s/images/banner-img.jpg', 'thumbnail_url' => '%s/images/banner-img.jpg', 'description' => esc_html_x( 'Default Banner', 'header image description', 'blossom-spa' ), ), ) ); /** * Add Custom Images sizes. */ add_image_size( 'blossom-spa-schema', 600, 60 ); add_image_size( 'blossom-spa-single', 1920, 700, true ); add_image_size( 'blossom-spa-service', 480, 324, true ); add_image_size( 'blossom-spa-team', 270, 300, true ); add_image_size( 'blossom-spa-pagination', 370, 247, true ); add_image_size( 'blossom-spa-blog-list', 640, 480, true ); add_image_size( 'blossom-spa-blog-classic', 776, 517, true ); add_image_size( 'blossom-spa-blog-classic-full', 1170, 517, true ); add_image_size( 'blossom-spa-related', 110, 83, true ); /** Starter Content */ $starter_content = array( // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'home', 'blog', ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set up nav menus for each of the two areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "top" location. 'primary' => array( 'name' => __( 'Primary', 'blossom-spa' ), 'items' => array( 'page_home', 'page_blog', ) ) ), ); $starter_content = apply_filters( 'blossom_spa_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); // Add theme support for Responsive Videos. add_theme_support( 'jetpack-responsive-videos' ); // Add excerpt support for pages add_post_type_support( 'page', 'excerpt' ); // Remove widget block. remove_theme_support( 'widgets-block-editor' ); } endif; add_action( 'after_setup_theme', 'blossom_spa_setup' ); if( ! function_exists( 'blossom_spa_content_width' ) ) : /** * 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 blossom_spa_content_width() { /** * content width as per theme. */ $GLOBALS['content_width'] = apply_filters( 'blossom_spa_content_width', 767 ); } endif; add_action( 'after_setup_theme', 'blossom_spa_content_width', 0 ); if( ! function_exists( 'blossom_spa_template_redirect_content_width' ) ) : /** * Adjust content_width value according to template. * * @return void */ function blossom_spa_template_redirect_content_width(){ $sidebar = blossom_spa_sidebar(); if( $sidebar ){ $GLOBALS['content_width'] = 767; }else{ if( is_singular() ){ if( blossom_spa_sidebar( true ) === 'full-width centered' ){ $GLOBALS['content_width'] = 767; }else{ $GLOBALS['content_width'] = 1170; } }else{ $GLOBALS['content_width'] = 1170; } } } endif; add_action( 'template_redirect', 'blossom_spa_template_redirect_content_width' ); if( ! function_exists( 'blossom_spa_scripts' ) ) : /** * Enqueue scripts and styles. */ function blossom_spa_scripts() { // Use minified libraries if SCRIPT_DEBUG is false $build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : ''; $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; if( blossom_spa_is_woocommerce_activated() ) wp_enqueue_style( 'blossom-spa-woocommerce', get_template_directory_uri(). '/css' . $build . '/woocommerce' . $suffix . '.css', array(), BLOSSOM_SPA_THEME_VERSION ); wp_enqueue_style( 'animate', get_template_directory_uri(). '/css' . $build . '/animate' . $suffix . '.css', array(), '3.5.2' ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri(). '/css' . $build . '/owl.carousel' . $suffix . '.css', array(), '2.2.1' ); wp_enqueue_style( 'perfect-scrollbar', get_template_directory_uri(). '/css' . $build . '/perfect-scrollbar' . $suffix . '.css', array(), '3.1.5' ); if ( get_theme_mod( 'ed_localgoogle_fonts', false ) && ! is_customize_preview() && ! is_admin() && get_theme_mod( 'ed_preload_local_fonts', false ) ) { blossom_spa_preload_local_fonts( blossom_spa_fonts_url() ); } wp_enqueue_style( 'blossom-spa-google-fonts', blossom_spa_fonts_url(), array(), null ); wp_enqueue_style( 'blossom-spa', get_stylesheet_uri(), array(), BLOSSOM_SPA_THEME_VERSION ); wp_enqueue_script( 'all', get_template_directory_uri() . '/js' . $build . '/all' . $suffix . '.js', array( 'jquery' ), '6.1.1', true ); wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js' . $build . '/v4-shims' . $suffix . '.js', array( 'jquery', 'all' ), '6.1.1', true ); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js' . $build . '/owl.carousel' . $suffix . '.js', array( 'jquery' ), '2.2.1', true ); wp_enqueue_script( 'owlcarousel2-a11ylayer', get_template_directory_uri() . '/js' . $build . '/owlcarousel2-a11ylayer' . $suffix . '.js', array( 'jquery', 'owl-carousel' ), '0.2.1', true ); wp_enqueue_script( 'perfect-scrollbar', get_template_directory_uri() . '/js' . $build . '/perfect-scrollbar' . $suffix . '.js', array( 'jquery' ), '1.3.0', true ); wp_enqueue_script( 'blossom-spa', get_template_directory_uri() . '/js' . $build . '/custom' . $suffix . '.js', array( 'jquery' ), BLOSSOM_SPA_THEME_VERSION, true ); wp_enqueue_script( 'blossom-spa-modal', get_template_directory_uri() . '/js' . $build . '/modal-accessibility' . $suffix . '.js', array( 'jquery' ), BLOSSOM_SPA_THEME_VERSION, true ); $array = array( 'rtl' => is_rtl(), ); wp_localize_script( 'blossom-spa', 'blossom_spa_data', $array ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } endif; add_action( 'wp_enqueue_scripts', 'blossom_spa_scripts' ); if( ! function_exists( 'blossom_spa_admin_scripts' ) ) : /** * Enqueue admin scripts and styles. */ function blossom_spa_admin_scripts(){ wp_enqueue_style( 'blossom-spa-admin', get_template_directory_uri() . '/inc/css/admin.css', '', BLOSSOM_SPA_THEME_VERSION ); } endif; add_action( 'admin_enqueue_scripts', 'blossom_spa_admin_scripts' ); if( ! function_exists( 'blossom_spa_body_classes' ) ) : /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function blossom_spa_body_classes( $classes ) { // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } // Adds a class of custom-background-image to sites with a custom background image. if ( get_background_image() ) { $classes[] = 'custom-background-image'; } // Adds a class of custom-background-color to sites with a custom background color. if ( get_background_color() != 'ffffff' ) { $classes[] = 'custom-background-color'; } if( is_home() || is_archive() || is_search() ){ $classes[] = get_theme_mod( 'blog_page_layout', 'list-layout' ); } if( is_single() || is_page() ){ $classes[] = 'underline'; } $classes[] = blossom_spa_sidebar( true ); return $classes; } endif; add_filter( 'body_class', 'blossom_spa_body_classes' ); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blossom_spa_pingback_header() { if ( is_singular() && pings_open() ) { echo ''; } } add_action( 'wp_head', 'blossom_spa_pingback_header' ); if( ! function_exists( 'blossom_spa_change_comment_form_default_fields' ) ) : /** * Change Comment form default fields i.e. author, email & url. * https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/ */ function blossom_spa_change_comment_form_default_fields( $fields ){ // get the current commenter if available $commenter = wp_get_current_commenter(); // core functionality $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); // Change just the author field $fields['author'] = '
'; $fields['email'] = ''; $fields['url'] = ''; return $fields; } endif; add_filter( 'comment_form_default_fields', 'blossom_spa_change_comment_form_default_fields' ); if( ! function_exists( 'blossom_spa_change_comment_form_defaults' ) ) : /** * Change Comment Form defaults * https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/ */ function blossom_spa_change_comment_form_defaults( $defaults ){ $defaults['comment_field'] = ''; $defaults['title_reply'] = esc_html__( 'Leave A Comment', 'blossom-spa' ); $defaults['title_reply_before'] = '