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-studio' ), 'secondary' => esc_html__( 'Secondary', 'blossom-studio' ), 'footer' => esc_html__( 'Footer', 'blossom-studio' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'blossom_studio_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( 'header-text' => array( 'site-title', 'site-description' ), ) ); /** * Add support for custom header. */ add_theme_support( 'custom-header', apply_filters( 'blossom_studio_custom_header_args', array( 'default-image' => '', 'video' => true, 'width' => 615, /** change width as per theme requirement */ 'height' => 615, /** change height as per theme requirement */ 'header-text' => false, 'flex-width' => true, 'flex-height' => true, ) ) ); /** * Add Custom Images sizes. */ add_image_size( 'blossom-studio-blog-grid', 335, 252, true ); add_image_size( 'blossom-studio-blog-classic', 710, 533, true ); add_image_size( 'blossom-studio-blog-classic-full', 710, 533, true ); add_image_size( 'blossom-studio-blog-section', 765, 574, true ); add_image_size( 'blossom-studio-shop', 371, 496, true ); add_image_size( 'blossom-studio-promo', 259, 346, true ); add_image_size( 'blossom-studio-single', 1170, 878, true ); add_image_size( 'blossom-studio-slider', 527, 702, 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-studio' ), 'items' => array( 'page_home', 'page_blog', ) ) ), ); $starter_content = apply_filters( 'blossom_studio_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' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. * */ add_editor_style( array( 'css' . $build . '/editor-style' . $suffix . '.css', blossom_studio_fonts_url() ) ); // Add support for block editor styles. add_theme_support( 'wp-block-styles' ); // Remove widget block. remove_theme_support( 'widgets-block-editor' ); } endif; add_action( 'after_setup_theme', 'blossom_studio_setup' ); if( ! function_exists( 'blossom_studio_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_studio_content_width() { $GLOBALS['content_width'] = apply_filters( 'blossom_studio_content_width', 760 ); } endif; add_action( 'after_setup_theme', 'blossom_studio_content_width', 0 ); if( ! function_exists( 'blossom_studio_template_redirect_content_width' ) ) : /** * Adjust content_width value according to template. * * @return void */ function blossom_studio_template_redirect_content_width(){ $sidebar = blossom_studio_sidebar(); if( $sidebar ){ $GLOBALS['content_width'] = 760; }else{ if( is_singular() ){ if( blossom_studio_sidebar( true ) === 'full-width centered' ){ $GLOBALS['content_width'] = 760; }else{ $GLOBALS['content_width'] = 1170; } }else{ $GLOBALS['content_width'] = 1170; } } } endif; add_action( 'template_redirect', 'blossom_studio_template_redirect_content_width' ); if( ! function_exists( 'blossom_studio_scripts' ) ) : /** * Enqueue scripts and styles. */ function blossom_studio_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_studio_is_woocommerce_activated() ) wp_enqueue_style( 'blossom-studio-woocommerce', get_template_directory_uri(). '/css' . $build . '/woocommerce' . $suffix . '.css', array(), BLOSSOM_STUDIO_THEME_VERSION ); wp_enqueue_style( 'blossom-studio-google-fonts', blossom_studio_fonts_url(), array(), null ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri(). '/css' . $build . '/owl.carousel' . $suffix . '.css', array(), '2.3.4' ); wp_enqueue_style( 'animate', get_template_directory_uri(). '/css' . $build . '/animate' . $suffix . '.css', array(), '3.5.2' ); wp_enqueue_style( 'blossom-studio', get_stylesheet_uri(), array(), BLOSSOM_STUDIO_THEME_VERSION ); wp_enqueue_style( 'blossom-studio-elementor', get_template_directory_uri(). '/css' . $build . '/elementor' . $suffix . '.css', array(), BLOSSOM_STUDIO_THEME_VERSION ); wp_enqueue_style( 'blossom-studio-gutenberg', get_template_directory_uri(). '/css' . $build . '/gutenberg' . $suffix . '.css', array(), BLOSSOM_STUDIO_THEME_VERSION ); wp_enqueue_script( 'all', get_template_directory_uri() . '/js' . $build . '/all' . $suffix . '.js', array( 'jquery' ), '5.6.3', true ); wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js' . $build . '/v4-shims' . $suffix . '.js', array( 'jquery', 'all' ), '5.6.3', true ); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js' . $build . '/owl.carousel' . $suffix . '.js', array( 'jquery' ), '2.3.4', 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( 'blossom-studio', get_template_directory_uri() . '/js' . $build . '/custom' . $suffix . '.js', array( 'jquery' ), BLOSSOM_STUDIO_THEME_VERSION, true ); wp_enqueue_script( 'blossom-studio-modal', get_template_directory_uri() . '/js' . $build . '/modal-accessibility' . $suffix . '.js', array( 'jquery' ), BLOSSOM_STUDIO_THEME_VERSION, true ); $array = array( 'rtl' => is_rtl(), 'auto' => (bool) get_theme_mod( 'slider_auto', true ), 'loop' => (bool) get_theme_mod( 'slider_loop', true ), 'animation' => esc_attr( get_theme_mod( 'slider_animation' ) ), 'speed' => absint( get_theme_mod( 'slider_speed', 5000 ) ), ); wp_localize_script( 'blossom-studio', 'blossom_studio_data', $array ); if ( blossom_studio_is_jetpack_activated( true ) ) { wp_enqueue_style( 'tiled-gallery', plugins_url() . '/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css' ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } endif; add_action( 'wp_enqueue_scripts', 'blossom_studio_scripts' ); if( ! function_exists( 'blossom_studio_admin_scripts' ) ) : /** * Enqueue admin scripts and styles. */ function blossom_studio_admin_scripts( $hook ){ wp_enqueue_style( 'blossom-studio-admin', get_template_directory_uri() . '/inc/css/admin.css', '', BLOSSOM_STUDIO_THEME_VERSION ); } endif; add_action( 'admin_enqueue_scripts', 'blossom_studio_admin_scripts' ); add_action( 'elementor/editor/before_enqueue_scripts', 'blossom_studio_admin_scripts' ); if( ! function_exists( 'blossom_studio_block_editor_styles' ) ) : /** * Enqueue editor styles for Gutenberg */ function blossom_studio_block_editor_styles() { // Use minified libraries if SCRIPT_DEBUG is false $build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : ''; $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; // Block styles. wp_enqueue_style( 'blossom-studio-block-editor-style', get_template_directory_uri() . '/css' . $build . '/editor-block' . $suffix . '.css' ); wp_add_inline_style( 'blossom-studio-block-editor-style', blossom_studio_gutenberg_inline_style() ); // Add custom fonts. wp_enqueue_style( 'blossom-studio-google-fonts', blossom_studio_fonts_url(), array(), null ); } endif; add_action( 'enqueue_block_editor_assets', 'blossom_studio_block_editor_styles' ); if( ! function_exists( 'blossom_studio_body_classes' ) ) : /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function blossom_studio_body_classes( $classes ) { $editor_options = get_option( 'classic-editor-replace' ); $allow_users_options = get_option( 'classic-editor-allow-users' ); // 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( !blossom_studio_is_classic_editor_activated() || ( blossom_studio_is_classic_editor_activated() && $editor_options == 'block' ) || ( blossom_studio_is_classic_editor_activated() && $allow_users_options == 'allow' && has_blocks() ) ) { $classes[] = 'blossom-studio-has-blocks'; } if( is_singular( 'post' ) ) { $classes[] = 'style-one'; } $classes[] = blossom_studio_sidebar( true ); if( is_home() ) { $classes[] = 'blog-classic-layout'; } if( is_archive() || is_search() ) { $classes[] = 'grid-layout'; } return $classes; } endif; add_filter( 'body_class', 'blossom_studio_body_classes' ); if( ! function_exists( 'blossom_studio_post_classes' ) ) : /** * Add custom classes to the array of post classes. */ function blossom_studio_post_classes( $classes ){ $classes[] = 'has-meta has-sticky-meta'; return $classes; } endif; add_filter( 'post_class', 'blossom_studio_post_classes' ); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blossom_studio_pingback_header() { if ( is_singular() && pings_open() ) { echo ''; } } add_action( 'wp_head', 'blossom_studio_pingback_header' ); if( ! function_exists( 'blossom_studio_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_studio_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_studio_change_comment_form_default_fields' ); if( ! function_exists( 'blossom_studio_change_comment_form_defaults' ) ) : /** * Change Comment Form defaults * https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/ */ function blossom_studio_change_comment_form_defaults( $defaults ){ $defaults['comment_field'] = '

'; return $defaults; } endif; add_filter( 'comment_form_defaults', 'blossom_studio_change_comment_form_defaults' ); if ( ! function_exists( 'blossom_studio_excerpt_more' ) ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... * */ function blossom_studio_excerpt_more( $more ) { return is_admin() ? $more : ' … '; } endif; add_filter( 'excerpt_more', 'blossom_studio_excerpt_more' ); if ( ! function_exists( 'blossom_studio_excerpt_length' ) ) : /** * Changes the default 55 character in excerpt */ function blossom_studio_excerpt_length( $length ) { $excerpt_length = get_theme_mod( 'excerpt_length', 55 ); return is_admin() ? $length : absint( $excerpt_length ); } endif; add_filter( 'excerpt_length', 'blossom_studio_excerpt_length', 999 ); if( ! function_exists( 'blossom_studio_get_the_archive_title' ) ) : /** * Filter Archive Title */ function blossom_studio_get_the_archive_title( $title ){ $ed_prefix = get_theme_mod( 'ed_prefix_archive', true ); if( is_post_type_archive( 'product' ) ){ $title = '

' . get_the_title( get_option( 'woocommerce_shop_page_id' ) ) . '

'; }else{ if( is_category() ){ if( $ed_prefix ) { $title = '

' . esc_html( single_cat_title( '', false ) ) . '

'; }else{ $title = ''. esc_html__( 'TAGGED IN', 'blossom-studio' ) . '

' . esc_html( single_cat_title( '', false ) ) . '

'; } } elseif( is_tag() ){ if( $ed_prefix ) { $title = '

' . esc_html( single_tag_title( '', false ) ) . '

'; }else{ $title = ''. esc_html__( 'TAGGED IN', 'blossom-studio' ) . '

' . esc_html( single_tag_title( '', false ) ) . '

'; } }elseif( is_year() ){ if( $ed_prefix ){ $title = '

' . get_the_date( _x( 'Y', 'yearly archives date format', 'blossom-studio' ) ) . '

'; }else{ $title = ''. esc_html__( 'Year', 'blossom-studio' ) . '

' . get_the_date( _x( 'Y', 'yearly archives date format', 'blossom-studio' ) ) . '

'; } }elseif( is_month() ){ if( $ed_prefix ){ $title = '

' . get_the_date( _x( 'F Y', 'monthly archives date format', 'blossom-studio' ) ) . '

'; }else{ $title = ''. esc_html__( 'Month', 'blossom-studio' ) . '

' . get_the_date( _x( 'F Y', 'monthly archives date format', 'blossom-studio' ) ) . '

'; } }elseif( is_day() ){ if( $ed_prefix ){ $title = '

' . get_the_date( _x( 'F j, Y', 'daily archives date format', 'blossom-studio' ) ) . '

'; }else{ $title = ''. esc_html__( 'Day', 'blossom-studio' ) . '

' . get_the_date( _x( 'F j, Y', 'daily archives date format', 'blossom-studio' ) ) . '

'; } }elseif( is_post_type_archive() ) { if( $ed_prefix ){ $title = '

' . post_type_archive_title( '', false ) . '

'; }else{ $title = ''. esc_html__( 'Archives', 'blossom-studio' ) . '

' . post_type_archive_title( '', false ) . '

'; } }elseif( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); if( $ed_prefix ){ $title = '

' . single_term_title( '', false ) . '

'; }else{ $title = '' . $tax->labels->singular_name . '

' . single_term_title( '', false ) . '

'; } } } return $title; } endif; add_filter( 'get_the_archive_title', 'blossom_studio_get_the_archive_title' ); if( ! function_exists( 'blossom_studio_remove_archive_description' ) ) : /** * filter the_archive_description & get_the_archive_description to show post type archive * @param string $description original description * @return string post type description if on post type archive */ function blossom_studio_remove_archive_description( $description ){ $ed_shop_archive_description = get_theme_mod( 'ed_shop_archive_description', false ); if( is_post_type_archive( 'product' ) ) { if( ! $ed_shop_archive_description ){ $description = ''; } } return $description; } endif; add_filter( 'get_the_archive_description', 'blossom_studio_remove_archive_description' ); if( ! function_exists( 'blossom_studio_get_comment_author_link' ) ) : /** * Filter to modify comment author link * @link https://developer.wordpress.org/reference/functions/get_comment_author_link/ */ function blossom_studio_get_comment_author_link( $return, $author, $comment_ID ){ $comment = get_comment( $comment_ID ); $url = get_comment_author_url( $comment ); $author = get_comment_author( $comment ); if ( empty( $url ) || 'http://' == $url ) $return = ''. esc_html( $author ) .''; else $return = ''; return $return; } endif; add_filter( 'get_comment_author_link', 'blossom_studio_get_comment_author_link', 10, 3 ); if( ! function_exists( 'blossom_studio_filter_post_gallery' ) ) : /** * Filter the output of the gallery. */ function blossom_studio_filter_post_gallery( $output, $attr, $instance ){ global $post, $wp_locale; $html5 = current_theme_supports( 'html5', 'gallery' ); $atts = shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => $html5 ? 'figure' : 'dl', 'icontag' => $html5 ? 'div' : 'dt', 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => '' ), $attr, 'gallery' ); $id = intval( $atts['id'] ); if ( ! empty( $atts['include'] ) ) { $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( ! empty( $atts['exclude'] ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { $output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n"; } return $output; } $itemtag = tag_escape( $atts['itemtag'] ); $captiontag = tag_escape( $atts['captiontag'] ); $icontag = tag_escape( $atts['icontag'] ); $valid_tags = wp_kses_allowed_html( 'post' ); if ( ! isset( $valid_tags[ $itemtag ] ) ) { $itemtag = 'dl'; } if ( ! isset( $valid_tags[ $captiontag ] ) ) { $captiontag = 'dd'; } if ( ! isset( $valid_tags[ $icontag ] ) ) { $icontag = 'dt'; } $columns = intval( $atts['columns'] ); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $gallery_style = ''; /** * Filter whether to print default gallery styles. * * @since 3.1.0 * * @param bool $print Whether to print default gallery styles. * Defaults to false if the theme supports HTML5 galleries. * Otherwise, defaults to true. */ if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) { $gallery_style = " \n\t\t"; } $size_class = sanitize_html_class( $atts['size'] ); $gallery_div = "\n"; return $output; } endif; if( class_exists( 'Jetpack' ) ){ if( !Jetpack::is_module_active( 'carousel' ) ){ add_filter( 'post_gallery', 'blossom_studio_filter_post_gallery', 10, 3 ); } }else{ add_filter( 'post_gallery', 'blossom_studio_filter_post_gallery', 10, 3 ); } if( ! function_exists( 'blossom_studio_admin_notice' ) ) : /** * Addmin notice for getting started page */ function blossom_studio_admin_notice(){ global $pagenow; $theme_args = wp_get_theme(); $meta = get_option( 'blossom_studio_admin_notice' ); $name = $theme_args->__get( 'Name' ); $current_screen = get_current_screen(); if( 'themes.php' == $pagenow && !$meta ){ if( $current_screen->id !== 'dashboard' && $current_screen->id !== 'themes' ){ return; } if( is_network_admin() ){ return; } if( ! current_user_can( 'manage_options' ) ){ return; } ?>

'blossom_studio_dynamic_mce_css', '_nonce' => wp_create_nonce( 'blossom_studio_dynamic_mce_nonce', __FILE__ ) ), admin_url( 'admin-ajax.php' ) ); return $mce_css; } endif; add_filter( 'mce_css', 'blossom_studio_dynamic_mce_css' ); if ( ! function_exists( 'blossom_studio_dynamic_mce_css_ajax_callback' ) ) : /** * Ajax Callback */ function blossom_studio_dynamic_mce_css_ajax_callback(){ /* Check nonce for security */ $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : ''; if( ! wp_verify_nonce( $nonce, 'blossom_studio_dynamic_mce_nonce' ) ){ die(); // don't print anything } /* Get Link Color */ $primary_font = get_theme_mod( 'primary_font', 'Esteban' ); $primary_fonts = blossom_studio_get_fonts( $primary_font, 'regular' ); $secondary_font = get_theme_mod( 'secondary_font', 'DM Serif Text' ); $secondary_fonts = blossom_studio_get_fonts( $secondary_font, 'regular' ); /* Set File Type and Print the CSS Declaration */ header( 'Content-type: text/css' ); echo ':root .mce-content-body { --primary-font: ' . esc_html( $primary_fonts['font'] ) . '; --secondary-font: ' . esc_html( $secondary_fonts['font'] ) . '; }'; die(); // end ajax process. } endif; add_action( 'wp_ajax_blossom_studio_dynamic_mce_css', 'blossom_studio_dynamic_mce_css_ajax_callback' ); add_action( 'wp_ajax_no_priv_blossom_studio_dynamic_mce_css', 'blossom_studio_dynamic_mce_css_ajax_callback' ); if ( ! function_exists( 'blossom_studio_check_hide_title' ) ) { /** * Check hide title. * * @param bool $val default value. * * @return bool */ function blossom_studio_check_hide_title( $val ) { if ( blossom_studio_is_elementor_activated() && blossom_studio_is_elementor_activated_post() ) { $current_doc = \Elementor\Plugin::instance()->documents->get( get_the_ID() ); if ( $current_doc && 'yes' === $current_doc->get_settings( 'hide_title' ) ) { $val = false; } } return $val; } } add_filter( 'blossom_studio_page_title', 'blossom_studio_check_hide_title' );