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-floral-pro' ),
'secondary' => esc_html__( 'Secondary', 'blossom-floral-pro' ),
'footer' => esc_html__( 'Footer', 'blossom-floral-pro' )
) );
/*
* 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_floral_pro_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_floral_pro_custom_header_args',
array(
'default-image' => '',
'video' => true,
'width' => 1920, /** change width as per theme requirement */
'height' => 760, /** change height as per theme requirement */
'header-text' => false
)
)
);
/**
* Add Custom Images sizes.
*/
add_image_size( 'blossom-floral-schema', 600, 60 );
add_image_size( 'blossom-floral-slider', 1920, 700, true );
add_image_size( 'blossom-floral-slider-two', 500, 657, true );
add_image_size( 'blossom-floral-slider-three', 635, 846, true );
add_image_size( 'blossom-floral-featured', 400, 230, true );
add_image_size( 'blossom-floral-with-sidebar', 730, 400, true );
add_image_size( 'blossom-floral-related', 360, 203, true );
add_image_size( 'blossom-floral-shop', 269, 364, true );
add_image_size( 'blossom-floral-blog-home', 755, 424, true );
add_image_size( 'blossom-floral-single', 1140, 641, true );
add_image_size( 'blossom-floral-popular-home', 460, 259, true );
add_image_size( 'blossom-floral-blog-list-small', 345, 195, true );
add_image_size( 'blossom-floral-blog-list', 340, 454, true );
add_image_size( 'blossom-floral-blog-list-big', 350, 465, true );
add_image_size( 'blossom-floral-blog-list-medium', 320, 425, true );
add_image_size( 'blossom-floral-featured-section', 360, 486, true );
add_image_size( 'blossom-floral-single-lay-five', 952, 647, true );
// 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 full and wide align images.
add_theme_support( 'align-wide' );
// 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_floral_pro_fonts_url()
)
);
// Add support for block editor styles.
add_theme_support( 'wp-block-styles' );
//Remove block widgets
remove_theme_support( 'widgets-block-editor' );
}
endif;
add_action( 'after_setup_theme', 'blossom_floral_pro_setup' );
if( ! function_exists( 'blossom_floral_pro_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_floral_pro_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blossom_floral_pro_content_width', 775 );
}
endif;
add_action( 'after_setup_theme', 'blossom_floral_pro_content_width', 0 );
if( ! function_exists( 'blossom_floral_pro_template_redirect_content_width' ) ) :
/**
* Adjust content_width value according to template.
*
* @return void
*/
function blossom_floral_pro_template_redirect_content_width(){
$sidebar = blossom_floral_pro_sidebar();
if( $sidebar ){
$GLOBALS['content_width'] = 775;
}else{
if( is_singular() ){
if( blossom_floral_pro_sidebar( true ) === 'full-width centered' ){
$GLOBALS['content_width'] = 775;
}else{
$GLOBALS['content_width'] = 1170;
}
}else{
$GLOBALS['content_width'] = 1170;
}
}
}
endif;
add_action( 'template_redirect', 'blossom_floral_pro_template_redirect_content_width' );
if( ! function_exists( 'blossom_floral_pro_scripts' ) ) :
/**
* Enqueue scripts and styles.
*/
function blossom_floral_pro_scripts() {
// Use minified libraries if SCRIPT_DEBUG is false
$build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : '';
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
if( is_woocommerce_activated() )
wp_enqueue_style( 'blossom-floral-pro-woocommerce', get_template_directory_uri(). '/css' . $build . '/woocommerce' . $suffix . '.css', array(), BLOSSOM_FLORAL_PRO_THEME_VERSION );
if ( get_theme_mod( 'ed_localgoogle_fonts', false ) && ! is_customize_preview() && ! is_admin() && get_theme_mod( 'ed_preload_local_fonts', false ) ) {
blossom_floral_pro_preload_local_fonts( blossom_floral_pro_fonts_url() );
}
wp_enqueue_style( 'blossom-floral-pro-google-fonts', blossom_floral_pro_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-floral-pro', get_stylesheet_uri(), array(), BLOSSOM_FLORAL_PRO_THEME_VERSION );
wp_enqueue_style( 'blossom-floral-pro-elementor', get_template_directory_uri(). '/css' . $build . '/elementor' . $suffix . '.css', array(), BLOSSOM_FLORAL_PRO_THEME_VERSION );
wp_enqueue_style( 'blossom-floral-pro-gutenberg', get_template_directory_uri(). '/css' . $build . '/gutenberg' . $suffix . '.css', array(), BLOSSOM_FLORAL_PRO_THEME_VERSION );
if( get_theme_mod( 'ed_lazy_load', false ) || get_theme_mod( 'ed_lazy_load_cimage', false ) || get_theme_mod( 'ed_lazyload_gravatar', false ) ){
wp_enqueue_script( 'layzr', get_template_directory_uri() . '/js' . $build . '/layzr' . $suffix . '.js', array('jquery'), '2.0.4', true );
}
//Fancy Box
if( get_theme_mod( 'ed_lightbox', false ) ){
wp_enqueue_style( 'jquery-fancybox', get_template_directory_uri() . '/css' . $build . '/jquery.fancybox' . $suffix . '.css', array(), '3.5.7' );
wp_enqueue_script( 'jquery-fancybox', get_template_directory_uri() . '/js' . $build . '/jquery.fancybox' . $suffix . '.js', array('jquery'), '3.5.7', true );
}
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.3.4', true );
$pagination = get_theme_mod( 'pagination_type', 'numbered' );
$loadmore = get_theme_mod( 'load_more_label', __( 'Load More Posts', 'blossom-floral-pro' ) );
$loading = get_theme_mod( 'loading_label', __( 'Loading...', 'blossom-floral-pro' ) );
$nomore = get_theme_mod( 'no_more_label', __( 'No More Post', 'blossom-floral-pro' ) );
// 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-floral-pro-ajax', get_template_directory_uri() . '/js' . $build . '/ajax' . $suffix . '.js', array('jquery'), BLOSSOM_FLORAL_PRO_THEME_VERSION, true );
wp_localize_script(
'blossom-floral-pro-ajax',
'blossom_floral_pro_ajax',
array(
'url' => admin_url( 'admin-ajax.php' ),
'startPage' => $paged,
'maxPages' => $max,
'nextLink' => next_posts( $max, false ),
'autoLoad' => $pagination,
'loadmore' => $loadmore,
'loading' => $loading,
'nomore' => $nomore,
'plugin_url' => plugins_url(),
)
);
wp_enqueue_script( 'blossom-floral-pro', get_template_directory_uri() . '/js' . $build . '/custom' . $suffix . '.js', array( 'jquery', 'masonry' ), BLOSSOM_FLORAL_PRO_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 ) ),
'h_layout' => esc_attr( get_theme_mod( 'header_layout', 'one' ) ),
'lightbox' => (bool) get_theme_mod( 'ed_lightbox', false ),
'drop_cap' => (bool) get_theme_mod( 'ed_drop_cap', false ),
'sticky' => (bool) get_theme_mod( 'ed_sticky_header', false ),
'sticky_widget' => (bool) get_theme_mod( 'ed_last_widget_sticky', false ),
);
wp_localize_script( 'blossom-floral-pro', 'blossom_floral_pro_data', $array );
if ( 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_floral_pro_scripts' );
if( ! function_exists( 'blossom_floral_pro_admin_scripts' ) ) :
/**
* Enqueue admin scripts and styles.
*/
function blossom_floral_pro_admin_scripts( $hook ){
wp_enqueue_style( 'blossom-floral-pro-admin', get_template_directory_uri() . '/inc/css/admin.css', '', BLOSSOM_FLORAL_PRO_THEME_VERSION );
if( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'user-new.php' || $hook == 'user-edit.php' || $hook == 'profile.php' ){
wp_enqueue_script( 'blossom-floral-pro-admin', get_template_directory_uri() . '/inc/js/admin.js', array( 'jquery', 'jquery-ui-sortable' ), BLOSSOM_FLORAL_PRO_THEME_VERSION, false );
}
}
endif;
add_action( 'admin_enqueue_scripts', 'blossom_floral_pro_admin_scripts' );
if( ! function_exists( 'blossom_floral_pro_block_editor_styles' ) ) :
/**
* Enqueue editor styles for Gutenberg
*/
function blossom_floral_pro_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-floral-pro-block-editor-style', get_template_directory_uri() . '/css' . $build . '/editor-block' . $suffix . '.css' );
wp_add_inline_style( 'blossom-floral-pro-block-editor-style', blossom_floral_pro_gutenberg_inline_style() );
// Add custom fonts.
wp_enqueue_style( 'blossom-floral-pro-google-fonts', blossom_floral_pro_fonts_url(), array(), null );
}
endif;
add_action( 'enqueue_block_editor_assets', 'blossom_floral_pro_block_editor_styles' );
if( ! function_exists( 'blossom_floral_pro_body_classes' ) ) :
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function blossom_floral_pro_body_classes( $classes ) {
$bg_pattern = get_theme_mod( 'bg_pattern', 'nobg' );
$bg = get_theme_mod( 'body_bg', 'image' );
$single_post_layout = blossom_floral_pro_single_meta_layout();
$sticky_widget = get_theme_mod( 'ed_last_widget_sticky', false );
$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( $bg == 'pattern' && $bg_pattern != 'nobg' ){
$classes[] = 'custom-background-image custom-background';
}
if( $bg == 'image' && 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() ) {
$classes[] = blossom_floral_pro_add_blog_class();
}
// Adds a class single post layout.
if( is_single() ) {
$classes[] = 'style-'.$single_post_layout;
}
if ( !is_classic_editor_activated() || ( is_classic_editor_activated() && $editor_options == 'block' ) || ( is_classic_editor_activated() && $allow_users_options == 'allow' && has_blocks() ) ) {
$classes[] = 'blossom-floral-pro-has-blocks';
}
if ( ( is_archive() && !( is_woocommerce_activated() && ( is_shop() || is_product_category() || is_product_tag() ) ) ) || is_search() ) {
$classes[] = blossom_floral_pro_add_archive_class();
}
if( $sticky_widget ) {
$classes[] = 'last-widget-sticky';
}
$classes[] = blossom_floral_pro_sidebar( true );
return $classes;
}
endif;
add_filter( 'body_class', 'blossom_floral_pro_body_classes' );
if( ! function_exists( 'blossom_floral_pro_post_classes' ) ) :
/**
* Add custom classes to the array of post classes.
*/
function blossom_floral_pro_post_classes( $classes ){
if( is_single() ){
$classes[] = 'has-meta';
}
$classes[] = 'latest_post';
return $classes;
}
endif;
add_filter( 'post_class', 'blossom_floral_pro_post_classes' );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function blossom_floral_pro_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '';
}
}
add_action( 'wp_head', 'blossom_floral_pro_pingback_header' );
if( ! function_exists( 'blossom_floral_pro_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_floral_pro_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_floral_pro_change_comment_form_default_fields' );
if( ! function_exists( 'blossom_floral_pro_change_comment_form_defaults' ) ) :
/**
* Change Comment Form defaults
* https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/
*/
function blossom_floral_pro_change_comment_form_defaults( $defaults ){
$defaults['comment_field'] = '';
return $defaults;
}
endif;
add_filter( 'comment_form_defaults', 'blossom_floral_pro_change_comment_form_defaults' );
if ( ! function_exists( 'blossom_floral_pro_excerpt_more' ) ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... *
*/
function blossom_floral_pro_excerpt_more( $more ) {
return is_admin() ? $more : ' … ';
}
endif;
add_filter( 'excerpt_more', 'blossom_floral_pro_excerpt_more' );
if ( ! function_exists( 'blossom_floral_pro_excerpt_length' ) ) :
/**
* Changes the default 55 character in excerpt
*/
function blossom_floral_pro_excerpt_length( $length ) {
$excerpt_length = get_theme_mod( 'excerpt_length', 30 );
return is_admin() ? $length : absint( $excerpt_length );
}
endif;
add_filter( 'excerpt_length', 'blossom_floral_pro_excerpt_length', 999 );
if( ! function_exists( 'blossom_floral_pro_exclude_cat' ) ) :
/**
* Exclude post with Category from blog and archive page.
*/
function blossom_floral_pro_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', 3 );
$repetitive_posts = get_theme_mod( 'include_repetitive_posts', true );
if( ! is_admin() && $query->is_main_query() && $query->is_home() && ( $ed_banner == 'slider_banner' ) && ! $repetitive_posts ){
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_floral_pro_exclude_cat' );
if( ! function_exists( 'blossom_floral_pro_get_the_archive_title' ) ) :
/**
* Filter Archive Title
*/
function blossom_floral_pro_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__( 'Browse Category For', 'blossom-floral-pro' ) . '' . esc_html( single_cat_title( '', false ) ) . '
';
}
}
elseif( is_tag() ){
if( $ed_prefix ) {
$title = '' . esc_html( single_tag_title( '', false ) ) . '
';
}else{
$title = ''. esc_html__( 'Browse Tag For', 'blossom-floral-pro' ) . '' . esc_html( single_tag_title( '', false ) ) . '
';
}
}elseif( is_year() ){
if( $ed_prefix ){
$title = '' . get_the_date( _x( 'Y', 'yearly archives date format', 'blossom-floral-pro' ) ) . '
';
}else{
$title = ''. esc_html__( 'Year', 'blossom-floral-pro' ) . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'blossom-floral-pro' ) ) . '
';
}
}elseif( is_month() ){
if( $ed_prefix ){
$title = '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'blossom-floral-pro' ) ) . '
';
}else{
$title = ''. esc_html__( 'Month', 'blossom-floral-pro' ) . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'blossom-floral-pro' ) ) . '
';
}
}elseif( is_day() ){
if( $ed_prefix ){
$title = '' . get_the_date( _x( 'F j, Y', 'daily archives date format', 'blossom-floral-pro' ) ) . '
';
}else{
$title = ''. esc_html__( 'Day', 'blossom-floral-pro' ) . '' . get_the_date( _x( 'F j, Y', 'daily archives date format', 'blossom-floral-pro' ) ) . '
';
}
}elseif( is_post_type_archive() ) {
if( $ed_prefix ){
$title = '' . post_type_archive_title( '', false ) . '
';
}else{
$title = ''. esc_html__( 'Archives', 'blossom-floral-pro' ) . '' . 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_floral_pro_get_the_archive_title' );
if( ! function_exists( 'blossom_floral_pro_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_floral_pro_remove_archive_description( $description ){
$ed_shop_archive_description = get_theme_mod( 'ed_shop_archive_description', false );
$shop_archive_description = get_theme_mod( 'shop_archive_description' );
if( is_post_type_archive( 'product' ) ) {
if( ! $ed_shop_archive_description ){
$description = '';
}else{
if( $shop_archive_description ) $description = $shop_archive_description;
}
}
return wpautop( wp_kses_post( $description ) );
}
endif;
add_filter( 'get_the_archive_description', 'blossom_floral_pro_remove_archive_description' );
if( ! function_exists( 'blossom_floral_pro_post_like_cb' ) ) :
/**
* Ajax Callback for post like
*
*/
function blossom_floral_pro_post_like_cb(){
$ed_post_title = get_theme_mod( 'ed_post_title', __( 'Like', 'blossom-floral-pro' ) );
$post_id = intval( $_POST['id'] );
$likes = ( $count = get_post_meta( $post_id, '_blossom_floral_pro_post_like', true ) ) ? $count : 0;
$ip_list = ( $ip = get_post_meta( $post_id, '_blossom_floral_pro_post_like_ip', true ) ) ? $ip : array();
if( blossom_floral_pro_likes_can( $post_id ) ){
$likes = $likes + 1;
$ip_list[] = blossom_floral_pro_get_real_ip_address();
update_post_meta( $post_id, '_blossom_floral_pro_post_like', $likes );
update_post_meta( $post_id, '_blossom_floral_pro_post_like_ip', $ip_list );
echo '' . esc_attr( $ed_post_title ) . '' . absint( $likes) . '
';
}
wp_die(); // this is required to terminate immediately and return a proper response
}
endif;
add_action( 'wp_ajax_blossom_floral_pro_post_like', 'blossom_floral_pro_post_like_cb' );
add_action( 'wp_ajax_nopriv_blossom_floral_pro_post_like', 'blossom_floral_pro_post_like_cb' );
if( ! function_exists( 'blossom_floral_pro_post_like_single_cb' ) ) :
/**
* Ajax Callback for post like-
*/
function blossom_floral_pro_post_like_single_cb(){
$ed_post_title = get_theme_mod( 'ed_post_title', __( 'Like', 'blossom-floral-pro' ) );
$post_id = intval( $_POST['id'] );
$likes = ( $count = get_post_meta( $post_id, '_blossom_floral_pro_post_like', true ) ) ? $count : 0;
$ip_list = ( $ip = get_post_meta( $post_id, '_blossom_floral_pro_post_like_ip', true ) ) ? $ip : array();
if( blossom_floral_pro_likes_can( $post_id ) ){
$likes = $likes + 1;
$ip_list[] = blossom_floral_pro_get_real_ip_address();
update_post_meta( $post_id, '_blossom_floral_pro_post_like', $likes );
update_post_meta( $post_id, '_blossom_floral_pro_post_like_ip', $ip_list );
echo '' . absint( $likes ) . '' . esc_attr( $ed_post_title ) . '';
}
wp_die(); // this is required to terminate immediately and return a proper response
}
endif;
add_action( 'wp_ajax_blossom_floral_pro_post_like_single', 'blossom_floral_pro_post_like_single_cb' );
add_action( 'wp_ajax_nopriv_blossom_floral_pro_post_like_single', 'blossom_floral_pro_post_like_single_cb' );
if( ! function_exists( 'blossom_floral_pro_allowed_social_protocols' ) ) :
/**
* List of allowed social protocols in HTML attributes.
* @param array $protocols Array of allowed protocols.
* @return array
*/
function blossom_floral_pro_allowed_social_protocols( $protocols ) {
$social_protocols = array(
'skype',
'viber'
);
return array_merge( $protocols, $social_protocols );
}
endif;
add_filter( 'kses_allowed_protocols' , 'blossom_floral_pro_allowed_social_protocols' );
if( ! function_exists( 'blossom_floral_pro_migrate_free_option' ) ) :
/**
* Function to migrate free theme option to pro theme
*/
function blossom_floral_pro_migrate_free_option(){
$fresh = get_option( '_blossom_floral_pro_fresh_install' ); //flag to check if it is first switch
if( ! $fresh ){
$options = get_option( 'theme_mods_blossom-floral' );
if( $options ){
//migrate free theme option to pro
foreach( $options as $option => $value ){
if( $option !== 'sidebars_widgets' ){
set_theme_mod( $option, $value );
}
}
}
update_option( '_blossom_floral_pro_fresh_install', true );
}
}
endif;
add_action( 'after_switch_theme', 'blossom_floral_pro_migrate_free_option' );
if( ! function_exists( 'blossom_floral_pro_single_post_schema' ) ) :
/**
* Single Post Schema
*
* @return string
*/
function blossom_floral_pro_single_post_schema() {
if ( is_singular( 'post' ) ) {
global $post;
$custom_logo_id = get_theme_mod( 'custom_logo' );
$site_logo = wp_get_attachment_image_src( $custom_logo_id , 'blossom-floral-schema' );
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
$excerpt = blossom_floral_pro_escape_text_tags( $post->post_excerpt );
$content = $excerpt === "" ? mb_substr( blossom_floral_pro_escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
$schema_type = ! empty( $custom_logo_id ) && has_post_thumbnail( $post->ID ) ? "BlogPosting" : "Blog";
$args = array(
"@context" => "http://schema.org",
"@type" => $schema_type,
"mainEntityOfPage" => array(
"@type" => "WebPage",
"@id" => esc_url( get_permalink( $post->ID ) )
),
"headline" => esc_html( get_the_title( $post->ID ) ),
"datePublished" => esc_html( get_the_time( DATE_ISO8601, $post->ID ) ),
"dateModified" => esc_html( get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ) ),
"author" => array(
"@type" => "Person",
"name" => blossom_floral_pro_escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) )
),
"description" => ( class_exists('WPSEO_Meta') ? WPSEO_Meta::get_value( 'metadesc' ) : $content )
);
if ( has_post_thumbnail( $post->ID ) ) :
$args['image'] = array(
"@type" => "ImageObject",
"url" => $images[0],
"width" => $images[1],
"height" => $images[2]
);
endif;
if ( $custom_logo_id ) :
$args['publisher'] = array(
"@type" => "Organization",
"name" => esc_html( get_bloginfo( 'name' ) ),
"description" => wp_kses_post( get_bloginfo( 'description' ) ),
"logo" => array(
"@type" => "ImageObject",
"url" => $site_logo[0],
"width" => $site_logo[1],
"height" => $site_logo[2]
)
);
endif;
echo '';
}
}
endif;
add_action( 'wp_head', 'blossom_floral_pro_single_post_schema' );
if( ! function_exists( 'blossom_floral_pro_get_comment_author_link' ) ) :
/**
* Filter to modify comment author link
* @link https://developer.wordpress.org/reference/functions/get_comment_author_link/
*/
function blossom_floral_pro_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 = '' . esc_html( $author ) . '';
return $return;
}
endif;
add_filter( 'get_comment_author_link', 'blossom_floral_pro_get_comment_author_link', 10, 3 );
if( ! function_exists( 'blossom_floral_pro_filter_post_gallery' ) ) :
/**
* Filter the output of the gallery.
*/
function blossom_floral_pro_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 = "";
/**
* Filter the default gallery shortcode CSS styles.
*
* @since 2.5.0
*
* @param string $gallery_style Default CSS styles and opening HTML div container
* for the gallery shortcode output.
*/
$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
$i = 0;
foreach ( $attachments as $id => $attachment ) {
$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
//$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr ); // for attachment url
$image_output = "
";
$image_output .= wp_get_attachment_image( $id, $atts['size'], false, $attr );
$image_output .= "";
} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
} else {
$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr ); //for attachment page
}
$image_meta = wp_get_attachment_metadata( $id );
$orientation = '';
if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
}
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
<{$icontag} class='gallery-icon {$orientation}'>
$image_output
{$icontag}>";
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "
<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
" . wptexturize($attachment->post_excerpt) . "
{$captiontag}>";
}
$output .= "{$itemtag}>";
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
$output .= '
';
}
}
if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
$output .= "
";
}
$output .= "
\n";
return $output;
}
endif;
if( class_exists( 'Jetpack' ) ){
if( !Jetpack::is_module_active( 'carousel' ) ){
add_filter( 'post_gallery', 'blossom_floral_pro_filter_post_gallery', 10, 3 );
}
}else{
add_filter( 'post_gallery', 'blossom_floral_pro_filter_post_gallery', 10, 3 );
}
if( ! function_exists( 'blossom_floral_pro_google_analytics' ) ) :
/**
* Add Google Analytics Code in Head Tag.
*/
function blossom_floral_pro_google_analytics() {
$google_analytics = get_theme_mod( 'google_analytics' );
if( $google_analytics ) echo $google_analytics;
}
endif;
add_action( 'wp_head', 'blossom_floral_pro_google_analytics' );
if( ! function_exists( 'blossom_floral_pro_activate_notice' ) ) :
/**
* Theme activation notice.
*/
function blossom_floral_pro_activate_notice() {
global $current_user;
$theme_list = wp_get_theme( 'blossom-floral-pro' );
$name = $theme_list->get( 'Name' );
$textdomain = $theme_list->get( 'TextDomain' );
$current_screen = get_current_screen();
$add_license = get_option( 'blossom-floral-pro_license_key' );
$activate_license = get_option( 'blossom-floral-pro_license_key_status' );
$meta = get_option( 'blossom_floral_pro_review_notice' );
$transients = get_transient( 'blossom_floral_pro_review_transient' );
$statuses = array( 'invalid', 'inactive', 'expired', 'disabled', 'site_inactive' );
if( $theme_list->exists() && ( empty( $add_license ) || in_array( $activate_license, $statuses ) ) && $current_screen->base != 'appearance_page_blossom-floral-pro-license' ) { ?>
', esc_html( $name ), '' ) ; ?>
'blossom_floral_pro_dynamic_mce_css', '_nonce' => wp_create_nonce( 'blossom_floral_pro_dynamic_mce_nonce', __FILE__ ) ), admin_url( 'admin-ajax.php' ) );
return $mce_css;
}
endif;
add_filter( 'mce_css', 'blossom_floral_pro_dynamic_mce_css' );
if ( ! function_exists( 'blossom_floral_pro_dynamic_mce_css_ajax_callback' ) ) :
/**
* Ajax Callback
*/
function blossom_floral_pro_dynamic_mce_css_ajax_callback(){
/* Check nonce for security */
$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : '';
if( ! wp_verify_nonce( $nonce, 'blossom_floral_pro_dynamic_mce_nonce' ) ){
die(); // don't print anything
}
$child_theme_support = get_theme_mod( 'child_additional_support', 'default' );
if( $child_theme_support == 'floralfashion' ){
$primary_font = get_theme_mod( 'primary_font_ff', 'Inter' );
$primary_fonts = blossom_floral_pro_get_fonts( $primary_font, 'regular' );
$secondary_font = get_theme_mod( 'secondary_font_ff', 'Source Serif Pro' );
$secondary_fonts = blossom_floral_pro_get_fonts( $secondary_font, 'regular' );
$primary_color = get_theme_mod( 'primary_color_ff', '#fdbea9' );
$secondary_color = get_theme_mod( 'secondary_color_ff', '#ddbea9' );
}elseif( $child_theme_support == 'eleganttravel' ){
$primary_font = get_theme_mod( 'primary_font_et', 'Lora' );
$primary_fonts = blossom_floral_pro_get_fonts( $primary_font, 'regular' );
$secondary_font = get_theme_mod( 'secondary_font_et', 'EB Garamond' );
$secondary_fonts = blossom_floral_pro_get_fonts( $secondary_font, 'regular' );
$primary_color = get_theme_mod( 'primary_color_et', '#c9b09e' );
$secondary_color = get_theme_mod( 'secondary_color_et', '#f7775e' );
}else{
$primary_font = get_theme_mod( 'primary_font', 'Questrial' );
$primary_fonts = blossom_floral_pro_get_fonts( $primary_font, 'regular' );
$secondary_font = get_theme_mod( 'secondary_font', 'Crimson Pro' );
$secondary_fonts = blossom_floral_pro_get_fonts( $secondary_font, 'regular' );
$primary_color = get_theme_mod( 'primary_color', '#F2CAB3' );
$secondary_color = get_theme_mod( 'secondary_color', '#01BFBF' );
}
$body_font_color = get_theme_mod( 'body_font_color', '#001A1A' );
$rgb = blossom_floral_pro_hex2rgb( blossom_floral_pro_sanitize_hex_color( $primary_color ) );
$rgb2 = blossom_floral_pro_hex2rgb( blossom_floral_pro_sanitize_hex_color( $secondary_color ) );
$rgb3 = blossom_floral_pro_hex2rgb( blossom_floral_pro_sanitize_hex_color( $body_font_color ) );
/* 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'] ) . ';
--primary-color: ' . blossom_floral_pro_sanitize_hex_color( $primary_color ) . ';
--primary-color-rgb: ' . sprintf( '%1$s, %2$s, %3$s', $rgb[0], $rgb[1], $rgb[2] ) . ';
--secondary-color-rgb: ' . sprintf( '%1$s, %2$s, %3$s', $rgb2[0], $rgb2[1], $rgb2[2] ) . ';
--font-color: ' . blossom_floral_pro_sanitize_hex_color($body_font_color) . ';
--font-color-rgb: ' . sprintf('%1$s, %2$s, %3$s', $rgb3[0], $rgb3[1], $rgb3[2]) . ';
}
blockquote.wp-block-quote::before {
background-image: url(\'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="127.432" height="110.665" viewBox="0 0 127.432 110.665"%3E%3Cg id="Group_1443" data-name="Group 1443" transform="translate(0 0)" opacity="0.3"%3E%3Cpath id="Path_5841" data-name="Path 5841" d="M194.147,345.773c-3.28,2.743-6.38,5.4-9.538,7.955-2.133,1.724-4.343,3.3-6.522,4.934-6.576,4.932-13.3,5.586-20.243,1.173-2.939-1.868-4.314-5.268-5.477-8.714a68.381,68.381,0,0,1-2.375-9.783c-.994-5.555-2.209-11.138-1.557-16.906.577-5.112,1.16-10.251,2.163-15.248a23.117,23.117,0,0,1,3.01-7.026c2.8-4.7,5.735-9.276,8.779-13.732a23.928,23.928,0,0,1,4.793-5.371c2.207-1.72,3.608-4.17,5.148-6.6,3.216-5.068,6.556-10.013,9.8-15.052a28.681,28.681,0,0,0,1.475-3.084c.163-.338.31-.795.563-.943,2.775-1.632,5.518-3.377,8.376-4.752,2.016-.97,3.528,1.238,5.25,2.057a3.4,3.4,0,0,1-.148,1.769c-1.535,3.621-3.138,7.2-4.71,10.8-3.534,8.085-7.357,16-10.514,24.308-3.248,8.542-6.275,17.324-6.5,27.026-.065,2.869.266,5.75.374,8.627.065,1.753,1.017,1.914,2.044,1.753a11.21,11.21,0,0,0,7.146-4.324c1.41-1.752,2.246-1.821,3.817-.239,2.013,2.029,3.923,4.218,5.856,6.367a1.677,1.677,0,0,1,.429,1.023c-.151,3.187-.352,6.379-2.323,8.826C191.077,343.331,191.107,343.7,194.147,345.773Z" transform="translate(-70.424 -252.194)" fill="' . blossom_floral_pro_hash_to_percent23( blossom_floral_pro_sanitize_hex_color( $primary_color ) ) . '"/%3E%3Cpath id="Path_5842" data-name="Path 5842" d="M259.193,344.341c-4.6,5.231-8.984,10.521-15.185,12.561a11.207,11.207,0,0,0-3.233,2.286c-5.3,4.46-11.216,4.268-17.085,2.977-4.218-.928-6.7-5.277-7.252-10.588-.948-9.07.893-17.566,3.187-26,.1-.381.287-.73.373-1.114,1.88-8.435,5.937-15.587,9.2-23.164,2.257-5.249,5.674-9.732,8.694-14.758.6,1.231.936,2.1,1.4,2.854.947,1.552,2.144,1.065,2.942-.529a12.559,12.559,0,0,0,.69-2.028c.39-1.313,1.017-1.885,2.24-.981-.207-2.706-.034-5.343,2.121-6.4.81-.4,2.093.691,3.288,1.15.659-1.414,1.61-3.271,2.38-5.236a4.422,4.422,0,0,0-.234-2.1c-.3-1.353-.733-2.666-.974-4.032a11.511,11.511,0,0,1,1.917-8.21c1.1-1.825,2.033-3.8,3.059-5.687,2.014-3.709,4.517-4.035,7.155-.948a17.668,17.668,0,0,0,2.386,2.7,5.03,5.03,0,0,0,2.526.767,7.3,7.3,0,0,0,2.09-.458c-.477,1.277-.81,2.261-1.2,3.2-4.945,11.79-10.1,23.454-14.784,35.4-3.468,8.844-6.331,18.054-9.458,27.1a6.573,6.573,0,0,0-.226.964c-.649,3.651.393,4.769,3.4,4.056,2.592-.618,4.313-3.327,6.743-4.071a16.177,16.177,0,0,1,5.847-.563c1.236.087,2.6,3.97,2.248,6.047-.7,4.12-1.9,8.009-4.311,11.09C258.068,341.977,257.566,343.062,259.193,344.341Z" transform="translate(-216.183 -252.301)" fill="' . blossom_floral_pro_hash_to_percent23( blossom_floral_pro_sanitize_hex_color( $primary_color ) ) . '"/%3E%3C/g%3E%3C/svg%3E%0A\');
}';
die(); // end ajax process.
}
endif;
add_action( 'wp_ajax_blossom_floral_pro_dynamic_mce_css', 'blossom_floral_pro_dynamic_mce_css_ajax_callback' );
add_action( 'wp_ajax_no_priv_blossom_floral_pro_dynamic_mce_css', 'blossom_floral_pro_dynamic_mce_css_ajax_callback' );