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-pin' ), 'secondary' => esc_html__( 'Secondary', 'blossom-pin' ), ) ); /* * 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_pin_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( 'width' => 250, 'height' => 70, '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_pin_custom_header_args', array( 'default-image' => '', 'video' => true, 'width' => 1903, 'height' => 660, 'header-text' => false ) ) ); /** * Add Custom Images sizes. */ add_image_size( 'blossom-pin-schema', 600, 60 ); add_image_size( 'blossom-pin-slider', 375, 450, true ); add_image_size( 'blossom-pin-archive', 224, 280, true ); add_image_size( 'blossom-pin-related', 374, 249, true ); // Add theme support for Responsive Videos. add_theme_support( 'jetpack-responsive-videos' ); } endif; add_action( 'after_setup_theme', 'blossom_pin_setup' ); if( ! function_exists( 'blossom_pin_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_pin_content_width() { $GLOBALS['content_width'] = apply_filters( 'blossom_pin_content_width', 790 ); } endif; add_action( 'after_setup_theme', 'blossom_pin_content_width', 0 ); if( ! function_exists( 'blossom_pin_template_redirect_content_width' ) ) : /** * Adjust content_width value according to template. * * @return void */ function blossom_pin_template_redirect_content_width(){ $sidebar = blossom_pin_sidebar(); if( $sidebar ){ $GLOBALS['content_width'] = 790; }else{ $GLOBALS['content_width'] = 1216; } } endif; add_action( 'template_redirect', 'blossom_pin_template_redirect_content_width' ); if( ! function_exists( 'blossom_pin_scripts' ) ) : /** * Enqueue scripts and styles. */ function blossom_pin_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_pin_is_woocommerce_activated() ) wp_enqueue_style( 'blossom-pin-woocommerce', get_template_directory_uri(). '/css' . $build . '/woocommerce' . $suffix . '.css', array(), BLOSSOM_PIN_THEME_VERSION ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri(). '/css' . $build . '/owl.carousel' . $suffix . '.css', array(), '2.2.1' ); wp_enqueue_style( 'blossom-pin-google-fonts', blossom_pin_fonts_url(), array(), null ); wp_enqueue_style( 'blossom-pin', get_stylesheet_uri(), array(), BLOSSOM_PIN_THEME_VERSION ); wp_enqueue_script( 'all', get_template_directory_uri() . '/js' . $build . '/all' . $suffix . '.js', array( 'jquery' ), '5.3.1', true ); wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js' . $build . '/v4-shims' . $suffix . '.js', array( 'jquery' ), '5.3.1', true ); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js' . $build . '/owl.carousel' . $suffix . '.js', array( 'jquery' ), '2.0.1', true ); wp_enqueue_script( 'blossom-pin', get_template_directory_uri() . '/js' . $build . '/custom' . $suffix . '.js', array( 'jquery', 'masonry' ), BLOSSOM_PIN_THEME_VERSION, true ); $array = array( 'rtl' => is_rtl(), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'single' => is_single(), ); wp_localize_script( 'blossom-pin', 'blossom_pin_data', $array ); $pagination = get_theme_mod( 'pagination_type', 'default' ); if( $pagination == 'infinite_scroll' ){ // Add parameters for the JS global $wp_query; $max = $wp_query->max_num_pages; $paged = ( get_query_var( 'paged' ) > 1 ) ? get_query_var( 'paged' ) : 1; wp_enqueue_script( 'blossom-pin-ajax', get_template_directory_uri() . '/js' . $build . '/ajax' . $suffix . '.js', array('jquery'), BLOSSOM_PIN_THEME_VERSION, true ); wp_localize_script( 'blossom-pin-ajax', 'blossom_pin_ajax', array( 'url' => admin_url( 'admin-ajax.php' ), 'startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts( $max, false ), 'autoLoad' => $pagination, ) ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } endif; add_action( 'wp_enqueue_scripts', 'blossom_pin_scripts' ); if( ! function_exists( 'blossom_pin_admin_scripts' ) ) : /** * Enqueue admin scripts and styles. */ function blossom_pin_admin_scripts( $hook_suffix ){ wp_enqueue_style( 'blossom-pin-admin', get_template_directory_uri() . '/inc/css/admin.css', '', BLOSSOM_PIN_THEME_VERSION ); } endif; add_action( 'admin_enqueue_scripts', 'blossom_pin_admin_scripts' ); if( ! function_exists( 'blossom_pin_body_classes' ) ) : /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function blossom_pin_body_classes( $classes ) { global $wp_query; // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } if ( $wp_query->found_posts == 0 ) { $classes[] = 'no-post'; } // 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'; } $classes[] = blossom_pin_sidebar( true ); return $classes; } endif; add_filter( 'body_class', 'blossom_pin_body_classes' ); if( ! function_exists( 'blossom_pin_post_classes' ) ) : /** * Add custom classes to the array of post classes. */ function blossom_pin_post_classes( $classes ){ if( is_search() || is_archive()){ $classes[] = 'search-post'; } $classes[] = 'latest_post'; return $classes; } endif; add_filter( 'post_class', 'blossom_pin_post_classes' ); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blossom_pin_pingback_header() { if ( is_singular() && pings_open() ) { echo ''; } } add_action( 'wp_head', 'blossom_pin_pingback_header' ); if( ! function_exists( 'blossom_pin_change_comment_form_default_fields' ) ) : /** * Change Comment form default fields i.e. author, email & url. */ function blossom_pin_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_pin_change_comment_form_default_fields' ); if( ! function_exists( 'blossom_pin_change_comment_form_defaults' ) ) : /** * Change Comment Form defaults */ function blossom_pin_change_comment_form_defaults( $defaults ){ $defaults['comment_field'] = ''; return $defaults; } endif; add_filter( 'comment_form_defaults', 'blossom_pin_change_comment_form_defaults' ); if ( ! function_exists( 'blossom_pin_excerpt_more' ) ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... * */ function blossom_pin_excerpt_more( $more ) { return is_admin() ? $more : ' … '; } endif; add_filter( 'excerpt_more', 'blossom_pin_excerpt_more' ); if ( ! function_exists( 'blossom_pin_excerpt_length' ) ) : /** * Changes the default 55 character in excerpt */ function blossom_pin_excerpt_length( $length ) { $excerpt_length = get_theme_mod( 'excerpt_length', 55 ); return is_admin() ? $length : absint( $excerpt_length ); } endif; add_filter( 'excerpt_length', 'blossom_pin_excerpt_length', 999 ); if( ! function_exists( 'blossom_pin_exclude_cat' ) ) : /** * Exclude post with Category from blog and archive page. */ function blossom_pin_exclude_cat( $query ){ $ed_banner = get_theme_mod( 'ed_banner_section', 'slider_banner' ); $slider_type = get_theme_mod( 'slider_type', 'latest_posts' ); $slider_cat = get_theme_mod( 'slider_cat' ); $posts_per_page = get_theme_mod( 'no_of_slides', 7 ); if( ! is_admin() && $query->is_main_query() && $query->is_home() && $ed_banner == 'slider_banner' ){ if( $slider_type === 'cat' && $slider_cat ){ $query->set( 'category__not_in', array( $slider_cat ) ); }elseif( $slider_type == 'latest_posts' ){ $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true ); $latest = get_posts( $args ); $excludes = array(); foreach( $latest as $l ){ array_push( $excludes, $l->ID ); } $query->set( 'post__not_in', $excludes ); } } } endif; add_filter( 'pre_get_posts', 'blossom_pin_exclude_cat' ); if( ! function_exists( 'blossom_pin_get_the_archive_title' ) ) : /** * Filter Archive Title */ function blossom_pin_get_the_archive_title( $title ){ $ed_prefix = get_theme_mod( 'ed_prefix_archive', false ); if( is_category() ){ if( $ed_prefix ){ $title = '