<?php
/**
 * Tattoopress frontend theme specific functions
 *
 * @package WordPress
 * @subpackage Tattoopress
 * @version 3.3.4
 */

defined( 'ABSPATH' ) || exit;

/*
--------------------------------------------------------------------

	FONTS

----------------------------------------------------------------------
*/

/**
 * Add custom fonts
 *
 * @param  array $google_fonts array of Google fonts.
 * @return array
 */
function tattoopress_add_custom_fonts( $custom_fonts ) {

	$default_fonts = array(
		'TattooInk'  => 'TattooInk',
		'CuteTattoo' => 'CuteTattoo',
		'TattooShop' => 'TattooShop',
	);

	foreach ( $default_fonts as $key => $value ) {
		if ( ! isset( $custom_fonts[ $key ] ) ) {
			$custom_fonts[ $key ] = $value;
		}
	}

	return $custom_fonts;
}
add_filter( 'wvc_fonts', 'tattoopress_add_custom_fonts' );
add_filter( 'tattoopress_mods_fonts', 'tattoopress_add_custom_fonts' );

/**
 * Add google fonts
 */
function tattoopress_add_google_font( $google_fonts ) {

	$default_fonts = array(
		'Roboto'     => 'Roboto:400,500,600,700,900',
		'Raleway'    => 'Raleway:400,500,600,700,900',
		'Montserrat' => 'Montserrat:400,500,600,700,900',
		'Oswald'     => 'Oswald',
	);

	foreach ( $default_fonts as $key => $value ) {
		if ( ! isset( $google_fonts[ $key ] ) ) {
			$google_fonts[ $key ] = $value;
		}
	}

	return $google_fonts;
}
add_filter( 'tattoopress_google_fonts', 'tattoopress_add_google_font' );



/**
 * Added selector to menu_selectors
 *
 * @param  array $selectors navigation items CSS selectors.
 * @return array $selectors
 */
function tattoopress_add_menu_selectors( $selectors ) {

	$selectors[] = '.category-filter ul li a';
	$selectors[] = '.cart-panel-buttons a';

	return $selectors;
}
add_filter( 'tattoopress_menu_selectors', 'tattoopress_add_menu_selectors' );
/**
 * Added selector to heading_family_selectors
 *
 * @param  array $selectors headings related CSS selectors.
 * @return array $selectors
 */
function tattoopress_add_heading_family_selectors( $selectors ) {

	$selectors[] = '.wvc-tabs-menu li a';
	$selectors[] = '.woocommerce-tabs ul.tabs li a';
	$selectors[] = '.wvc-process-number';
	$selectors[] = '.wvc-button';
	$selectors[] = '.wvc-svc-item-title';
	$selectors[] = '.button';
	$selectors[] = '.onsale, .category-label';
	$selectors[] = '.entry-post-grid_classic .sticky-post';
	$selectors[] = '.entry-post-metro .sticky-post';
	$selectors[] = 'input[type=submit], .wvc-mailchimp-submit';
	$selectors[] = '.nav-next,.nav-previous';
	$selectors[] = '.wvc-embed-video-play-button';
	// $selectors[] = '.category-filter ul li';
	$selectors[] = '.wvc-ati-title';
	$selectors[] = '.wvc-team-member-role';
	$selectors[] = '.wvc-svc-item-tagline';
	$selectors[] = '.entry-metro insta-username';
	$selectors[] = '.wvc-testimonial-cite';
	$selectors[] = '.tattoopress-button-special';
	$selectors[] = '.tattoopress-button-special-accent';
	$selectors[] = '.tattoopress-button-solid';
	$selectors[] = '.tattoopress-button-outline';
	$selectors[] = '.tattoopress-button-solid-accent';
	$selectors[] = '.tattoopress-button-outline-accent';
	$selectors[] = '.tattoopress-button-text';
	$selectors[] = '.tattoopress-button-text-accent';
	$selectors[] = '.wvc-wc-cat-title';
	$selectors[] = '.wvc-pricing-table-button a';
	// $selectors[] = '.load-more-button-line';
	$selectors[] = '.view-post';
	$selectors[] = '.wolf-gram-follow-button';
	// $selectors[] = '#tattoopress-percent';
	$selectors[] = '.wvc-pie-counter';
	$selectors[] = '.work-meta-label';
	$selectors[] = '.comment-reply-link';
	$selectors[] = '.logo-text, .date-block';
	$selectors[] = '.menu-button-primary a, .menu-button-secondary a';
	$selectors[] = '.single-post-nav-item > a, .post-nav-title, .related-posts .entry-title';
	$selectors[] = '.tattoopress-modern .navigation-number, #back-to-top:before';

	return $selectors;
}
add_filter( 'tattoopress_heading_family_selectors', 'tattoopress_add_heading_family_selectors' );

/**
 * Added selector to heading_family_selectors
 *
 * @param  array $selectors headings related CSS selectors.
 * @return array $selectors
 */
function tattoopress_add_tattoopress_heading_selectors( $selectors ) {

	$selectors[] = '.wvc-tabs-menu li a';
	$selectors[] = '.woocommerce-tabs ul.tabs li a';
	$selectors[] = '.wvc-process-number';
	$selectors[] = '.wvc-svc-item-title';
	$selectors[] = '.wvc-wc-cat-title';
	$selectors[] = '.logo-text';
	$selectors[] = '.onsale, .category-label';
	$selectors[] = '.single-post-nav-item > a, .post-nav-title';
	// $selectors[] = '.menu-button-primary a, .menu-button-secondary a';

	return $selectors;
}
add_filter( 'tattoopress_heading_selectors', 'tattoopress_add_tattoopress_heading_selectors' );

/*
--------------------------------------------------------------------

	POST TYPES DISPLAY

----------------------------------------------------------------------
*/

/**
 * Get available display options for posts
 *
 * @return array
 */
function tattoopress_set_post_display_options() {

	return array(
		'grid'        => esc_html__( 'Grid', 'tattoopress' ),
		'grid_modern' => esc_html__( 'Grid Modern', 'tattoopress' ),
		'masonry'     => esc_html__( 'Masonry', 'tattoopress' ),
		'lateral'     => esc_html__( 'Lateral', 'tattoopress' ),
		'standard'    => esc_html__( 'Standard', 'tattoopress' ),
	);
}
add_filter( 'tattoopress_post_display_options', 'tattoopress_set_post_display_options' );

/**
 * Get available display options for works
 *
 * @return array
 */
function tattoopress_set_work_display_options() {

	return array(
		'grid'    => esc_html__( 'Grid', 'tattoopress' ),
		'metro'   => esc_html__( 'Metro', 'tattoopress' ),
		'masonry' => esc_html__( 'Masonry', 'tattoopress' ),
	);
}
add_filter( 'tattoopress_work_display_options', 'tattoopress_set_work_display_options' );

/**
 * Get available display options for galleries/albums
 *
 * @return array
 */
function tattoopress_set_gallery_display_options() {

	return array(
		'grid'    => esc_html__( 'Grid', 'tattoopress' ),
		'masonry' => esc_html__( 'Masonry', 'tattoopress' ),
		'metro'   => esc_html__( 'Metro', 'tattoopress' ),
	);
}
add_filter( 'tattoopress_gallery_display_options', 'tattoopress_set_gallery_display_options' );

/**
 * Get available display options for products
 *
 * @return array
 */
function tattoopress_set_product_display_options() {

	return array(
		'grid' => esc_html__( 'Grid', 'tattoopress' ),
		// 'metro' => esc_html__( 'Metro', 'tattoopress' ),
	);
}
add_filter( 'tattoopress_product_display_options', 'tattoopress_set_product_display_options' );

/**
 * Set shop display
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_product_display( $string ) {

	return 'grid';
}
add_filter( 'tattoopress_mod_product_display', 'tattoopress_set_product_display', 40 );


/*
--------------------------------------------------------------------

	THEME HOOKS

----------------------------------------------------------------------
*/

/**
 * Login popup markup
 */
function tattoopress_login_form_markup() {
	if ( function_exists( 'wvc_login_form' ) && class_exists( 'WooCommerce' ) ) {

		$skin_class = apply_filters( 'tattoopress_login_form_container_class', 'wvc-font-dark' );
		?>
		<div id="loginform-overlay">
			<div id="loginform-overlay-inner">
				<div id="loginform-overlay-content" class="<?php echo esc_attr( $skin_class ); ?>">
					<a href="#" id="close-vertical-bar-menu-icon" class="close-panel-button close-loginform-button">X</a>
					<?php echo wvc_login_form(); ?>
				</div>
			</div>
		</div>
		<?php
	}
}
add_action( 'tattoopress_body_start', 'tattoopress_login_form_markup', 5 );

add_filter(
	'wvc_default_twitter_text_align',
	function( $align ) {
		return $align;
	}
);

add_filter(
	'wvc_login_form_submit_button_class',
	function( $class ) {
		$class = 'button tattoopress-button-solid';

		return $class;
	}
);

add_filter(
	'tattoopress_proceed_to_checkout_button_class',
	function( $class ) {
		$class = 'checkout-button button tattoopress-button-solid';

		return $class;
	}
);

add_filter(
	'tattoopress_event_grid_entry_title_class',
	function() {
		return '';
	}
);

add_filter(
	'tattoopress_site_footer_class',
	function( $class ) {
		return 'wvc-font-light wvc-parent-row ' . $class;
	}
);

add_filter(
	'wvc_last_posts_big_slider_caption_container_additional_class',
	function( $class ) {
		return 'wvc-font-light wvc-row-bg-transparent';
	}
);

/**
 * Default separtor height
 */
add_filter(
	'wvc_separator_default_height',
	function( $string ) {
		return '2px';
	}
);

/**
 * Default separtor height
 */
add_filter(
	'wvc_separator_default_width',
	function( $string ) {
		return '100%';
	}
);

/**
 * Add currency switcher
 */
function tattoopress_output_currency_switcher() {

	$cta_content = tattoopress_get_inherit_mod( 'menu_cta_content_type', 'none' );

	$is_wc_page_child = is_page() && wp_get_post_parent_id( get_the_ID() ) == tattoopress_get_woocommerce_shop_page_id() && tattoopress_get_woocommerce_shop_page_id(); // phpcs:ignore
	$is_wc            = tattoopress_is_woocommerce_page() || is_singular( 'product' ) || $is_wc_page_child;

	if ( apply_filters( 'tattoopress_force_display_nav_shop_icons', $is_wc ) ) { // can be disable just in case.
		$cta_content = 'shop_icons';
	}

	if ( 'shop_icons' === $cta_content && tattoopress_get_inherit_mod( 'currency_switcher' ) ) {

		if ( function_exists( 'wwcs_currency_switcher' ) ) {
			echo '<div class="cta-item currency-switcher">';
			wwcs_currency_switcher();
			echo '</div>';
		} elseif ( defined( 'WOOCS_VERSION' ) ) {
			echo '<div class="cta-item currency-switcher">';
			echo do_shortcode( '[woocs style=1]' );
			echo '</div>';
		}
	}
}
add_action( 'tattoopress_secondary_menu', 'tattoopress_output_currency_switcher', 100 );

/**
 * Overwrite standard post entry slider image size
 */
function tattoopress_overwrite_entry_slider_img_size( $size ) {

	 add_filter(
		'tattoopress_entry_slider_image_size',
		function() {
			return '847x508';
		}
	);
	add_image_size( 'tattoopro-masonry', 700, 1500, false );
}
add_action( 'after_setup_theme', 'tattoopress_overwrite_entry_slider_img_size', 50 );


/*
--------------------------------------------------------------------

	NAVIGATION

----------------------------------------------------------------------
*/

/**
 * Set sticky menu scrollpoint
 *
 * @param int|string $int
 * @return int
 */
function tattoopress_set_sticky_menu_scrollpoint( $int ) {

	$int = 200;

	return $int;
}
add_filter( 'tattoopress_sticky_menu_scrollpoint', 'tattoopress_set_sticky_menu_scrollpoint' );

/**
 * Add vertical menu location
 */
function tattoopress_add_lateral_menu( $menus ) {

	$menus['vertical'] = esc_html__( 'Vertical Menu (optional)', 'tattoopress' );

	return $menus;

}
add_filter( 'tattoopress_menus', 'tattoopress_add_lateral_menu' );

/**
 * Set mobile menu template
 *
 * @param string $string Mobile menu template slug.
 * @return string
 */
function tattoopress_set_mobile_menu_template( $string ) {

	return 'content-mobile-alt';
}
add_filter( 'tattoopress_mobile_menu_template', 'tattoopress_set_mobile_menu_template' );

/**
 * Add mobile closer overlay
 */
function tattoopress_add_mobile_panel_closer_overlay() {
	?>
	<div id="mobile-panel-closer-overlay" class="panel-closer-overlay toggle-mobile-menu"></div>
	<?php
}
add_action( 'tattoopress_main_content_start', 'tattoopress_add_mobile_panel_closer_overlay' );

/**
 * Mobile menu
 */
function tattoopress_mobile_alt_menu() {
	?>
	<div id="mobile-menu-panel">
		<a href="#" id="close-mobile-menu-icon" class="close-panel-button toggle-mobile-menu">X</a>
		<div id="mobile-menu-panel-inner">
		<?php
			/**
			 * Menu
			 */
			tattoopress_primary_mobile_navigation();
		?>
		</div><!-- .mobile-menu-panel-inner -->
	</div><!-- #mobile-menu-panel -->
	<?php
}
add_action( 'tattoopress_body_start', 'tattoopress_mobile_alt_menu' );

/**
 * Secondary navigation hook
 *
 * Display cart icons, social icons or secondary menu depending on cuzstimizer option
 */
function tattoopress_output_mobile_complementary_menu( $context = 'desktop' ) {
	if ( 'mobile' === $context ) {
		$cta_content = tattoopress_get_inherit_mod( 'menu_cta_content_type', 'none' );
		// can be disable just in case.
		/**
		 * Force shop icons on woocommerce pages
		 */
		$is_wc_page_child = is_page() && wp_get_post_parent_id( get_the_ID() ) == tattoopress_get_woocommerce_shop_page_id() && tattoopress_get_woocommerce_shop_page_id(); // phpcs:ignore
		$is_wc            = tattoopress_is_woocommerce_page() || is_singular( 'product' ) || $is_wc_page_child;

		if ( apply_filters( 'tattoopress_force_display_nav_shop_icons', $is_wc ) ) { // can be disable just in case.
			$cta_content = 'shop_icons';
		}

		if ( 'shop_icons' === $cta_content ) {
			if ( tattoopress_display_account_menu_item() ) :
				?>
				<div class="account-container cta-item">
					<?php
						/**
						 * account icon
						 */
						tattoopress_account_menu_item();
					?>
				</div><!-- .cart-container -->
				<?php
			endif;

			if ( tattoopress_display_cart_menu_item() ) {
				?>
				<div class="cart-container cta-item">
					<?php
						/**
						 * Cart icon
						 */
						tattoopress_cart_menu_item();
					?>
				</div><!-- .cart-container -->
				<?php
			}
		}
	}
}
add_action( 'tattoopress_secondary_menu', 'tattoopress_output_mobile_complementary_menu', 10, 1 );

/**
 * Sidepanel font class
 */
function tattoopress_set_sidepanel_font_class( $class ) {

	if ( tattoopress_get_inherit_mod( 'side_panel_bg_img' ) ) {
		$class .= ' wvc-font-light';
	} else {
		if ( 'light' === tattoopress_get_color_tone( tattoopress_get_inherit_mod( 'submenu_background_color' ) ) ) {
			$class .= ' wvc-font-dark';
		} else {
			$class .= ' wvc-font-light';
		}
	}

	return $class;
}
add_filter( 'tattoopress_side_panel_class', 'tattoopress_set_sidepanel_font_class' );

/**
 *  Enable side panel with overlay menu
 *
 * @param string $layouts
 * @return string $layouts
 */
function tattoopress_set_excluded_side_panel_menu_layout( $layouts ) {

	$overlay_key = null;
	foreach ( $layouts as $key => $value ) {
		if ( 'overlay' === $value ) {
			$overlay_key = $key;
		}
	}

	if ( $overlay_key && isset( $layouts[ $overlay_key ] ) ) {
		unset( $layouts[ $overlay_key ] );
	}

	return $layouts;
}
add_filter( 'tattoopress_excluded_side_panel_menu_layout', 'tattoopress_set_excluded_side_panel_menu_layout', 40 );

/*
--------------------------------------------------------------------

	THEME FILTERS

----------------------------------------------------------------------
*/

/**
 * Add additional JS scripts and functions
 */
function tattoopress_enqueue_additional_scripts() {

	$version = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? time() : tattoopress_get_theme_version();

	if ( ! tattoopress_is_wolf_extension_activated() ) {

		wp_register_style( 'ionicons', get_template_directory_uri() . '/assets/css/lib/fonts/ionicons/ionicons.min.css', array(), tattoopress_get_theme_version() );
		wp_register_style( 'elegant-icons', get_template_directory_uri() . '/assets/css/lib/fonts/elegant-icons/elegant-icons.min.css', array(), tattoopress_get_theme_version() );
		wp_register_style( 'dripicons', get_template_directory_uri() . '/assets/css/lib/fonts/dripicons-v2/dripicons.min.css', array(), tattoopress_get_theme_version() );
		wp_register_script( 'countup', get_template_directory_uri() . '/assets/js/lib/countUp.min.js', array(), '1.9.3', true );
		wp_register_script( 'inview', get_template_directory_uri() . '/assets/js/lib/jquery.inview.min.js', array( 'jquery' ), '1.3.0', true );
	}

	if ( is_singular( 'product' ) ) {
		wp_enqueue_script( 'jquery-ui-accordion' );
		wp_enqueue_script( 'wvc-accordion' );
	}

	wp_enqueue_style( 'ionicons' );
	wp_enqueue_style( 'dripicons' );
	wp_enqueue_style( 'elegant-icons' );

	wp_enqueue_script( 'jquery-effects-core' );
	wp_enqueue_script( 'inview' );
	wp_enqueue_script( 'parallax-scroll' );
	wp_enqueue_script( 'tattoopress-custom', get_template_directory_uri() . '/assets/js/t/tattoopress.js', array( 'jquery' ), $version, true );

	if ( 'hard' === tattoopress_get_inherit_mod( 'menu_sticky_type' ) ) {
		wp_localize_script(
			'wolftheme',
			'WolfFrameworkJSParams',
			array(
				'menuOffsetDesktop'    => 60,
				'menuOffsetMobile'     => 60,
				'menuOffsetBreakpoint' => 60,
				'menuOffset'           => 60,
			)
		);
	}
}
add_action( 'wp_enqueue_scripts', 'tattoopress_enqueue_additional_scripts', 40 );

/**
 * Add addictional post class
 *
 * @param array
 * @return array
 */
function tattoopress_additional_post_classes( $classes ) {

	$post_id        = get_the_ID();
	$post_type      = get_post_type();
	$force_is_loop  = apply_filters( 'tattoopress_post_force_loop_class', false );
	$loop_condition = ( ! is_single() && ! is_search() ) || tattoopress_is_portfolio() || tattoopress_is_videos() || tattoopress_is_blog() || $force_is_loop || ( is_search() && tattoopress_is_woocommerce_page() );

	// debug(  $loop_condition );

	if ( $loop_condition ) {
		if ( in_array( $post_type, array( 'post', 'work', 'product', 'video', 'release', 'event' ) ) ) {
			$skin = tattoopress_get_inherit_mod( $post_type . '_skin', '', $post_id );
			if ( $skin ) {
				$classes[] = 'entry-post-skin-' . $skin;
			}
		}

		if ( 'product' === $post_type ) {
			global $product;

			if ( $product->get_gallery_image_ids() ) {
				$classes[] = 'entry-product-has-gallery';
			}
		}
	} elseif ( is_singular( 'product' ) ) {
		$skin = tattoopress_get_inherit_mod( $post_type . '_skin', '', $post_id );
		if ( $skin ) {
			$classes[] = 'entry-post-skin-' . $skin;
		}
	}

	return $classes;
}
add_filter( 'post_class', 'tattoopress_additional_post_classes' );

/**
 * Add addictional body class
 *
 * @param array
 * @return array
 */
function tattoopress_additional_body_classes( $classes ) {

	$classes[] = 'wrapper-width-' . tattoopress_get_inherit_mod( 'wrapper_width', 1400 );

	$sticky_details_meta   = tattoopress_get_inherit_mod( 'product_sticky' ) && 'no' !== tattoopress_get_inherit_mod( 'product_sticky' );
	$single_product_layout = tattoopress_get_inherit_mod( 'product_single_layout' );

	if ( is_singular( 'product' ) && $sticky_details_meta && 'sidebar-right' !== $single_product_layout && 'sidebar-left' !== $single_product_layout ) {
		$classes[] = 'sticky-product-details';
	}

	if ( tattoopress_get_theme_mod( 'custom_cursor' ) ) {
		$classes[] = 'custom-cursor-enabled';
	}

	if ( get_post_meta( tattoopress_get_the_id(), '_hero_mousewheel', true ) ) {
		$classes[] = 'hero-mousewheel';
	}

	if ( class_exists( 'Wolf_Share' ) ) {
		$classes[] = 'wolf-share';
	}

	if ( tattoopress_get_inherit_mod( 'sticky_menu_transparent' ) ) {
		$classes[] = 'sticky-menu-transparent';
	}

	return $classes;

}
add_filter( 'body_class', 'tattoopress_additional_body_classes' );

/**
 * Set menu layout for shop children pages
 */
function tattoopress_set_shop_menu_layout( $layout ) {

	$is_wc_page_child = is_page() && wp_get_post_parent_id( get_the_ID() ) == tattoopress_get_woocommerce_shop_page_id() && tattoopress_get_woocommerce_shop_page_id(); // phpcs:ignore
	$is_wc            = tattoopress_is_woocommerce_page() || is_singular( 'product' ) || $is_wc_page_child;

	$shop_menu_layout_meta = get_post_meta( tattoopress_get_woocommerce_shop_page_id(), '_post_menu_layout', true );

	if ( $is_wc && $shop_menu_layout_meta ) {
		$layout = $shop_menu_layout_meta;
	}

	return $layout;

}
add_filter( 'tattoopress_menu_layout', 'tattoopress_set_shop_menu_layout' );

/**
 * Overwrite hamburger icon
 */
function tattoopress_set_hamburger_icon( $html, $class, $title_attr ) {

	if ( 'toggle-side-panel' === $class ) {

		$title_attr = esc_html__( 'Side Panel', 'tattoopress' );

	} else {
		$title_attr = esc_html__( 'Menu', 'tattoopress' );
	}

	ob_start();
	?>
	<a class="hamburger-link <?php echo esc_attr( $class ); ?>" href="#" title="<?php echo esc_attr( $title_attr ); ?>">
		<span class="hamburger-icon">
			<span class="line line-first"></span>
			<span class="line line-second"></span>
			<span class="line line-third"></span>
			<span class="cross">
				<span></span>
				<span></span>
			</span>
		</span>
	</a>
	<?php
	$html = ob_get_clean();

	return $html;

}
add_filter( 'tattoopress_hamburger_icon', 'tattoopress_set_hamburger_icon', 10, 3 );

/**
 * Disable single post pagination
 *
 * @param bool $bool
 * @return bool
 */
add_filter( 'tattoopress_disable_single_post_pagination', '__return_true' );

/**
 * Filter single work title
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_single_work_title( $string ) {

	return esc_html__( 'Details & Info', 'tattoopress' );
}
add_filter( 'tattoopress_single_work_title', 'tattoopress_set_single_work_title', 40 );

/**
 * Excerpt more
 *
 * Add span to allow more CSS tricks
 *
 * @return string
 */
function tattoopress_custom_more_text( $string ) {

	$text = '<small class="wvc-button-background-fill"></small><span>' . esc_html__( 'continue reading', 'tattoopress' ) . '</span>';

	return $text;
}
add_filter( 'tattoopress_more_text', 'tattoopress_custom_more_text', 40 );

/**
 * Set related posts text
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_related_posts_text( $text ) {

	return esc_html__( 'You May Also Like', 'tattoopress' );
}
add_filter( 'tattoopress_related_posts_text', 'tattoopress_set_related_posts_text' );

/**
 * Returns large
 */
function tattoopress_set_large_metro_thumbnail_size() {
	return 'large';
}

/**
 * Filter metro thumnail size depending on row context
 */
function tattoopress_optimize_metro_thumbnail_size( $atts ) {

	$column_type   = isset( $atts['column_type'] ) ? $atts['column_type'] : null;
	$content_width = isset( $atts['content_width'] ) ? $atts['content_width'] : null;

	if ( 'column' === $column_type ) {
		if ( 'full' === $content_width || 'large' === $content_width ) {
			add_filter( 'tattoopress_metro_thumbnail_size_name', 'tattoopress_set_large_metro_thumbnail_size' );
		}
	}
}
add_action( 'wvc_add_row_filters', 'tattoopress_optimize_metro_thumbnail_size', 10, 1 );

/* Remove metro thumbnail size filter */
add_action(
	'wvc_remove_row_filters',
	function() {
		remove_filter( 'tattoopress_metro_thumbnail_size_name', 'tattoopress_set_large_metro_thumbnail_size' );
	}
);

/**
 * Filter post modules
 *
 * @param array $atts
 * @return array $atts
 */
function tattoopress_filter_post_module_atts( $atts ) {

	$post_type           = $atts['post_type'];
	$affected_post_types = array( 'release', 'gallery' );

	if ( in_array( $post_type, $affected_post_types ) ) {

		if ( isset( $atts[ $post_type . '_display' ] ) && 'offgrid' === $atts[ $post_type . '_display' ] ) {
			$atts['item_animation']         = '';
			$atts[ $post_type . '_layout' ] = 'standard';
		}

		if ( isset( $atts[ $post_type . '_display' ] ) && 'brokengrid' === $atts[ $post_type . '_display' ] ) {
			$atts[ $post_type . '_layout' ] = 'standard';
			$atts['el_class']               = $atts['el_class'] . ' broken-grid';
		}

		if ( 'release' === $post_type ) {
			if ( isset( $atts[ $post_type . '_hover_effect' ] ) ) {
				if ( 'old' === $atts[ $post_type . '_hover_effect' ] ) {
					$atts[ $post_type . '_layout' ] = 'overlay';
					$atts['overlay_color']          = 'white';
					$atts['overlay_opacity']        = '70';
					$atts['overlay_text_color']     = 'black';
				}

				if ( 'none' === $atts[ $post_type . '_hover_effect' ] ) {
					$atts[ $post_type . '_layout' ] = 'standard';
				}
			}
		}

		if ( 'gallery' === $post_type ) {
			if ( isset( $atts[ $post_type . '_hover_effect' ] ) ) {
				if ( 'old' === $atts[ $post_type . '_hover_effect' ] ) {
					$atts[ $post_type . '_layout' ] = 'overlay';
					$atts['overlay_color']          = 'white';
					$atts['overlay_opacity']        = '100';
					$atts['overlay_text_color']     = 'black';
				}

				if ( 'none' === $atts[ $post_type . '_hover_effect' ] ) {
					$atts[ $post_type . '_layout' ] = 'standard';
				}
			}
		}

		if ( 'grunge' === $atts[ $post_type . '_hover_effect' ] ) {
			$atts[ $post_type . '_layout' ] = 'overlay';
			$atts['overlay_color']          = '';
			$atts['overlay_text_color']     = 'white';
		}

		if ( 'slide-up' === $atts[ $post_type . '_hover_effect' ] ) {
			$atts[ $post_type . '_layout' ] = 'overlay';
		}
	}

	return $atts;
}
add_filter( 'tattoopress_post_module_atts', 'tattoopress_filter_post_module_atts' );

/**
 * No header post types
 *
 * @param  array $post_types Post types where the default hero block is disabled.
 * @return array
 */
function tattoopress_filter_no_hero_post_types( $post_types ) {

	$post_types = array( 'product', 'attachment' );
	$post_types = array( 'attachment' );

	return $post_types;
}
add_filter( 'tattoopress_no_header_post_types', 'tattoopress_filter_no_hero_post_types', 40 );

/**
 *
 */
function tattoopress_show_shop_header_content_block_single_product( $bool ) {

	if ( is_singular( 'product' ) ) {
		$bool = true;
	}

	return $bool;
}
add_filter( 'tattoopress_force_display_shop_after_header_block', 'tattoopress_show_shop_header_content_block_single_product' );

/**
 * Read more text
 */
function tattoopress_view_post_text( $string ) {
	return esc_html__( 'Read more', 'tattoopress' );
}
add_filter( 'tattoopress_view_post_text', 'tattoopress_view_post_text' );

/**
 * Filter empty p tags in excerpt
 */
function tattoopress_filter_excerpt_empty_p_tags( $excerpt ) {

	return str_replace( '<p></p>', '', $excerpt );

}
add_filter( 'get_the_excerpt', 'tattoopress_filter_excerpt_empty_p_tags', 100 );

/**
 *  Set entry slider animation
 *
 * @param string $animation
 * @return string $animation
 */
function tattoopress_set_entry_slider_animation( $animation ) {
	return 'slide';
}
add_filter( 'tattoopress_entry_slider_animation', 'tattoopress_set_entry_slider_animation', 40 );

/**
 * Search form placeholder
 */
function tattoopress_set_searchform_placeholder( $string ) {
	return esc_attr_x( 'Search&hellip;', 'placeholder', 'tattoopress' );
}
add_filter( 'tattoopress_searchform_placeholder', 'tattoopress_set_searchform_placeholder', 40 );
add_filter( 'tattoopress_product_searchform_placeholder', 'tattoopress_set_searchform_placeholder', 40 );

/**
 * Search form placeholder text
 */
function tattoopress_searchform_placeholder_text( $string ) {
	return esc_html__( 'Type your search and hit enter&hellip;', 'tattoopress' );
}
add_filter( 'tattoopress_searchform_placeholder', 'tattoopress_searchform_placeholder_text' );

/**
 * Add form in no result page
 */
function tattoopress_add_no_result_form() {
	get_search_form();
}
add_action( 'tattoopress_no_result_end', 'tattoopress_add_no_result_form' );

/**
 *  Set smooth scroll speed
 *
 * @param string $speed
 * @return string $speed
 */
function tattoopress_set_smooth_scroll_speed( $speed ) {
	return 1500;
}
add_filter( 'tattoopress_smooth_scroll_speed', 'tattoopress_set_smooth_scroll_speed' );
add_filter( 'wvc_smooth_scroll_speed', 'tattoopress_set_smooth_scroll_speed' );

/**
 *  Set smooth scroll easing effect
 *
 * @param string $ease
 * @return string $ease
 */
function tattoopress_set_smooth_scroll_ease( $ease ) {
	return 'easeInOutQuint';
}
add_filter( 'tattoopress_smooth_scroll_ease', 'tattoopress_set_smooth_scroll_ease' );
add_filter( 'wvc_smooth_scroll_ease', 'tattoopress_set_smooth_scroll_ease' );
add_filter( 'wvc_fp_easing', 'tattoopress_set_smooth_scroll_ease' );

/**
 *  Set smooth scroll speed
 *
 * @param string $speed
 * @return string $speed
 */
function tattoopress_set_fp_anim_time( $speed ) {

	$speed = 1500;

	if ( is_page() || is_single() ) {
		if ( get_post_meta( tattoopress_get_the_id(), '_post_fullpage_animtime', true ) ) {
			$speed = absint( get_post_meta( tattoopress_get_the_id(), '_post_fullpage_animtime', true ) );
		}
	}

	return $speed;
}
add_filter( 'wvc_fp_animtime', 'tattoopress_set_fp_anim_time', 40 );

/**
 * Filter lightbox settings
 */
function tattoopress_filter_lightbox_settings( $settings ) {

	$settings['transitionEffect'] = 'fade';
	$settings['buttons']          = array(
		'zoom',
		// 'share',
		'close',
	);

	return $settings;
}
add_filter( 'tattoopress_fancybox_settings', 'tattoopress_filter_lightbox_settings' );

/**
 * Save modal window content after import
 */
function tattoopress_set_modal_window_content_after_import() {
	$post = get_page_by_title( 'Modal Window Content', OBJECT, 'wvc_content_block' );

	if ( $post && function_exists( 'wvc_update_option' ) ) {
		wvc_update_option( 'modal_window', 'content_block_id', $post->ID );
	}
}
add_action( 'pt-ocdi/after_import', 'tattoopress_set_modal_window_content_after_import' );

/**
 * Returns CSS for the color schemes.
 *
 * @param array $colors Color scheme colors.
 * @return string Color scheme CSS.
 */
function tattoopress_edit_color_scheme_css( $output, $colors ) {

	extract( $colors );

	$output = '';

	$overlay_accent_bg_color = sprintf( 'rgba( %s, 0.95)', tattoopress_hex_to_rgb( $accent_color ) );
	$border_color            = sprintf( 'rgba( %s, 0.03)', tattoopress_hex_to_rgb( $strong_text_color ) );
	$overlay_panel_bg_color  = sprintf( 'rgba( %s, 0.95)', tattoopress_hex_to_rgb( $submenu_background_color ) );

	$link_selector       = '.link, p:not(.attachment) > a:not(.no-link-style):not(.button):not(.button-download):not(.added_to_cart):not(.button-secondary):not(.menu-link):not(.filter-link):not(.entry-link):not(.more-link):not(.wvc-image-inner):not(.wvc-button):not(.wvc-bigtext-link):not(.wvc-fittext-link):not(.ui-tabs-anchor):not(.wvc-icon-title-link):not(.wvc-icon-link):not(.wvc-social-icon-link):not(.wvc-team-member-social):not(.wolf-tweet-link):not(.author-link):not(.gallery-quickview)';
	$link_selector_after = '.link:after, p:not(.attachment) > a:not(.no-link-style):not(.button):not(.button-download):not(.added_to_cart):not(.button-secondary):not(.menu-link):not(.filter-link):not(.entry-link):not(.more-link):not(.wvc-image-inner):not(.wvc-button):not(.wvc-bigtext-link):not(.wvc-fittext-link):not(.ui-tabs-anchor):not(.wvc-icon-title-link):not(.wvc-icon-link):not(.wvc-social-icon-link):not(.wvc-team-member-social):not(.wolf-tweet-link):not(.author-link):not(.gallery-quickview):after';

	$output .= "/* Color Scheme */

	/* Body Background Color */
	body,
	.frame-border,
	.site-container{
		background-color: $body_background_color;
	}

	/* Page Background Color */
	.site-header,
	.post-header-container,
	.content-inner,
	#logo-bar,
	.nav-bar,
	.loading-overlay,
	.no-hero #hero,
	.wvc-font-default,
	#topbar{
		background-color: $page_background_color;
	}

	/* Submenu color */
	#site-navigation-primary-desktop .mega-menu-panel,
	#site-navigation-primary-desktop ul.sub-menu,
	#mobile-menu-panel,
	.offcanvas-menu-panel,
	.lateral-menu-panel,
	.cart-panel,
	.wwcs-selector{
		background:$submenu_background_color;
	}

	.cart-panel{
		background:$submenu_background_color!important;
	}

	.panel-closer-overlay{
		//background:$submenu_background_color;
	}

	.overlay-menu-panel{
		background:$overlay_panel_bg_color;
	}

	/* Sub menu Font Color */
	.nav-menu-desktop li ul li:not(.menu-button-primary):not(.menu-button-secondary) .menu-item-text-container,
	.nav-menu-desktop li ul.sub-menu li:not(.menu-button-primary):not(.menu-button-secondary).menu-item-has-children > a:before,
	.nav-menu-desktop li ul li.not-linked > a:first-child .menu-item-text-container,
	.mega-menu-tagline-text,
	.wwcs-selector,
	.currency-switcher .woocs-style-1-dropdown .woocs-style-1-dropdown-menu{
		color: $submenu_font_color;
	}

	.cart-panel,
	.cart-panel a,
	.cart-panel strong,
	.cart-panel b{
		color: $submenu_font_color!important;
	}

	#close-side-panel-icon{
		color: $submenu_font_color!important;
	}

	.nav-menu-vertical li a,
	.nav-menu-mobile li a,
	.nav-menu-vertical li.menu-item-has-children:before,
	.nav-menu-vertical li.page_item_has_children:before,
	.nav-menu-vertical li.active:before,
	.nav-menu-mobile li.menu-item-has-children:before,
	.nav-menu-mobile li.page_item_has_children:before,
	.nav-menu-mobile li.active:before{
		color: $submenu_font_color!important;
	}

	.lateral-menu-panel .wvc-icon:before{
		color: $submenu_font_color!important;
	}

	.nav-menu-desktop li ul.sub-menu li.menu-item-has-children > a:before{
		color: $submenu_font_color;
	}

	.cart-panel,
	.cart-panel a,
	.cart-panel strong,
	.cart-panel b{
		color: $submenu_font_color!important;
	}

	/* Accent Color */
	.accent{
		color:$accent_color;
	}

	.accent-color-is-black .wvc-font-color-light .accent{
		color:white;
	}

	.logo-text:after{
		color:$accent_color;
	}

	#tattoopress-loading-point{
		color:$accent_color;
	}

	#back-to-top:hover{
		background:$accent_color!important;
		border-color:$accent_color!important;
	}

	#tattoopress-cursor-dot{
		background-color:$accent_color;
	}

	blockquote:before{
		color:$accent_color;
	}

	.tattoopress-heading:after{
		color:$accent_color;
	}

	.wvc-single-image-overlay-title span:after,
	.work-meta-value a:hover{
		color:$accent_color;
	}

	.nav-menu li.sale .menu-item-text-container:before,
	.nav-menu-mobile li.sale .menu-item-text-container:before
	{
		background:$accent_color!important;
	}

	.widget_price_filter .ui-slider .ui-slider-range,
	mark,
	p.demo_store,
	.woocommerce-store-notice{
		background-color:$accent_color;
	}

	.button-secondary{
		background-color:$accent_color;
		border-color:$accent_color;
	}

	.tattoopress-button-special-accent,
	.tattoopress-button-solid-accent{
		border-color:$accent_color;
	}

	.tattoopress-button-solid-accent,
	.tattoopress-button-special-accent{
		background-color:$accent_color;
	}

	.tattoopress-button-outline-accent{
		border-color:$accent_color;
	}

	.tattoopress-button-outline-accent:hover{
		background-color:$accent_color;
	}

	.entry-post-standard .entry-title a:hover,
	.entry-post-standard .entry-meta a:hover,
	.entry-post-grid .entry-title a:hover,
	.entry-post-grid .entry-meta a:hover,
	.entry-post-masonry .entry-title a:hover,
	.entry-post-masonry .entry-meta a:hover{
		color:$accent_color!important;
	}

	.wolf-twitter-widget a.wolf-tweet-link,
	.wolf-bigtweet-content a,
	.widget.widget_categories a:hover,
	.widget.widget_pages a:hover,
	.widget .tagcloud a:hover,
	.widget.widget_recent_comments a:hover,
	.widget.widget_recent_entries a:hover,
	.widget.widget_archive a:hover,
	.widget.widget_meta a:hover,
	.widget.widget_product_categories a:hover,
	.widget.widget_nav_menu a:hover,
	a.rsswidget:hover,
	.wvc-font-dark .wolf-twitter-widget a.wolf-tweet-link:hover,
	.wvc-font-dark .widget.widget_categories a:hover,
	.wvc-font-dark .widget.widget_pages a:hover,
	.wvc-font-dark .widget .tagcloud a:hover,
	.wvc-font-dark .widget.widget_recent_comments a:hover,
	.wvc-font-dark .widget.widget_recent_entries a:hover,
	.wvc-font-dark .widget.widget_archive a:hover,
	.wvc-font-dark .widget.widget_meta a:hover,
	.wvc-font-dark .widget.widget_product_categories a:hover,
	.wvc-font-dark .widget.widget_nav_menu a:hover,
	.wvc-font-dark a.rsswidget:hover{
		color:$accent_color!important;
	}

	.group_table td a:hover{
		color:$accent_color;
	}

	.fancybox-thumbs>ul>li:before{
		border-color:$accent_color;
	}

	.wvc-background-color-accent{
		background-color:$accent_color;
	}

	.accent-color-is-black .wvc-font-color-light .wvc_bar_color_filler{
		background-color:white!important;
	}

	.wvc-accordion-tab.ui-state-active a:after,
	.wvc-testimonial-avatar:after{
		color:$accent_color;
	}

	.wvc-tabs-menu li.ui-tabs-active a{
		color:$accent_color!important;
	}

	.wvc-highlight-accent{
		background-color:$accent_color;
		color:#fff;
	}

	.wvc-icon-background-color-accent{
		box-shadow:0 0 0 0 $accent_color;
		background-color:$accent_color;
		color:$accent_color;
		border-color:$accent_color;
	}

	.wvc-icon-background-color-accent .wvc-icon-background-fill{
		box-shadow:0 0 0 0 $accent_color;
		background-color:$accent_color;
	}

	.wvc-button-background-color-accent{
		background-color:$accent_color;
		color:$accent_color;
		border-color:$accent_color;
	}

	.wvc-button-background-color-accent .wvc-button-background-fill{
		box-shadow:0 0 0 0 $accent_color;
		background-color:$accent_color;
	}

	.wvc-svg-icon-color-accent svg * {
		stroke:$accent_color!important;
	}

	.wvc-one-page-nav-bullet-tip{
		background-color: $accent_color;
	}

	.wvc-one-page-nav-bullet-tip:before{
		border-color: transparent transparent transparent $accent_color;
	}

	.accent,
	.comment-reply-link,
	.bypostauthor .avatar{
		color:$accent_color;
	}

	.wvc-button-color-button-accent,
	.more-link,
	.buton-accent{
		background-color: $accent_color;
		border-color: $accent_color;
	}

	.wvc-ils-item-title:before {
		background-color: $accent_color!important;
	}

	.wvc-io-active .wvc-io-item-title:after,
	.wvc-interactive-overlay-item a:hover .wvc-io-item-title:after {
	    color:$accent_color;
	}

	.widget .tagcloud:before{
		 color:$accent_color;
	}

	.group_table td a:hover{
		color:$accent_color;
	}

	.added_to_cart, .button,
	.button-download,
	.more-link,
	.wvc-mailchimp-submit,
	input[type=submit]{
		background-color: $accent_color;
		border-color: $accent_color;
	}

	/* WVC icons */
	.wvc-icon-color-accent{
		color:$accent_color;
	}

	.wvc-icon-background-color-accent{
		box-shadow:0 0 0 0 $accent_color;
		background-color:$accent_color;
		color:$accent_color;
		border-color:$accent_color;
	}

	.wvc-icon-background-color-accent .wvc-icon-background-fill{
		box-shadow:0 0 0 0 $accent_color;
		background-color:$accent_color;
	}

	#ajax-progress-bar{
		background:$accent_color;
	}

	.background-accent{
		background: $accent_color!important;
	}

	.mejs-container .mejs-controls .mejs-time-rail .mejs-time-current,
	.mejs-container .mejs-controls .mejs-time-rail .mejs-time-current, .mejs-container .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{
		background: $accent_color!important;
	}

	.trigger{
		background-color: $accent_color!important;
		border : solid 1px $accent_color;
	}

	.bypostauthor .avatar {
		border: 3px solid $accent_color;
	}

	::selection {
		background: $accent_color;
	}
	::-moz-selection {
		background: $accent_color;
	}

	.spinner{
		color:$main_text_color;
	}

	/*********************
		WVC
	***********************/

	.wvc-it-label{
		color:$accent_color;
	}

	.wvc-icon-box.wvc-icon-type-circle .wvc-icon-no-custom-style.wvc-hover-fill-in:hover, .wvc-icon-box.wvc-icon-type-square .wvc-icon-no-custom-style.wvc-hover-fill-in:hover {
		-webkit-box-shadow: inset 0 0 0 1em $accent_color;
		box-shadow: inset 0 0 0 1em $accent_color;
		border-color: $accent_color;
	}

	.wvc-pricing-table-featured-text,
	.wvc-pricing-table-featured .wvc-pricing-table-button a{
		background: $accent_color;
	}

	.wvc-pricing-table-featured .wvc-pricing-table-price,
	.wvc-pricing-table-featured .wvc-pricing-table-currency {
		color: $accent_color;
	}

	.wvc-pricing-table-featured .wvc-pricing-table-price-strike:before {
		background-color: $accent_color;
	}

	.wvc-team-member-social-container a:hover{
		color: $accent_color;
	}

	/* Main Text Color */
	body,
	.nav-label{
		color:$main_text_color;
	}

	.spinner-color, .sk-child:before, .sk-circle:before, .sk-cube:before{
		background-color: $main_text_color!important;
	}

	/* Strong Text Color */
	a,strong,
	.products li .price,
	.products li .star-rating,
	.wr-print-button,
	table.cart thead, #content table.cart thead{
		color: $strong_text_color;
	}

	.bit-widget-container,
	.entry-link{
		color: $strong_text_color;
	}

	.wr-stars>span.wr-star-voted:before, .wr-stars>span.wr-star-voted~span:before{
		color: $strong_text_color!important;
	}

	/* Border Color */

	.widget-title,
	.woocommerce-tabs ul.tabs{
		border-bottom-color:$border_color;
	}

	.widget_layered_nav_filters ul li a{
		border-color:$border_color;
	}

	hr{
		background:$border_color;
	}
	";

	$link_selector_after  = '.link:after, .underline:after, p:not(.attachment) > a:not(.no-link-style):not(.button):not(.button-download):not(.added_to_cart):not(.button-secondary):not(.menu-link):not(.filter-link):not(.entry-link):not(.more-link):not(.wvc-image-inner):not(.wvc-button):not(.wvc-bigtext-link):not(.wvc-fittext-link):not(.ui-tabs-anchor):not(.wvc-icon-title-link):not(.wvc-icon-link):not(.wvc-social-icon-link):not(.wvc-team-member-social):not(.wolf-tweet-link):not(.author-link):after';
	$link_selector_before = '.link:before, .underline:before, p:not(.attachment) > a:not(.no-link-style):not(.button):not(.button-download):not(.added_to_cart):not(.button-secondary):not(.menu-link):not(.filter-link):not(.entry-link):not(.more-link):not(.wvc-image-inner):not(.wvc-button):not(.wvc-bigtext-link):not(.wvc-fittext-link):not(.ui-tabs-anchor):not(.wvc-icon-title-link):not(.wvc-icon-link):not(.wvc-social-icon-link):not(.wvc-team-member-social):not(.wolf-tweet-link):not(.author-link):before';

	$output .= "

		/*$link_selector_after,
		$link_selector_before{
			background: $accent_color!important;
		}*/

		.category-filter ul li a:before{
			background:$accent_color!important;
		}

		.category-label{
			//background:$accent_color!important;
		}

		/*.wvc-breadcrumb a:hover,*/
		.wvc-list a:hover{
			color:$accent_color!important;
		}

		/*.nav-menu-desktop > li:not(.menu-button-primary):not(.menu-button-secondary) > a:first-child .menu-item-text-container:before{
			color:$accent_color;
		}*/

		.nav-menu li.menu-button-primary > a:first-child > .menu-item-inner:not(:hover){
			background:$accent_color!important;
		}

		.nav-menu li.menu-button-primary > a:first-child > .menu-item-inner,
		.nav-menu li.menu-button-secondary > a:first-child > .menu-item-inner{
			border-color:$accent_color
		}

		.nav-menu li.menu-button-secondary > a:first-child > .menu-item-inner:hover{
			background:$accent_color;
		}

		.tattoopress-heading:after{
			color:$accent_color;
		}

		input[type=text]:focus,
		input[type=search]:focus,
		input[type=tel]:focus,
		input[type=time]:focus,
		input[type=url]:focus,
		input[type=week]:focus,
		input[type=password]:focus,
		input[type=checkbox]:focus,
		input[type=color]:focus,
		input[type=date]:focus,
		input[type=datetime]:focus,
		input[type=datetime-local]:focus,
		input[type=email]:focus,
		input[type=month]:focus,
		input[type=number]:focus,
		select:focus,
		textarea:focus{
			border-color:$accent_color!important;
		}

		/* Button */


		.entry-mp-event .entry-container,
		.wvc-recipe-instructions o li:before,
		.wvc-recipe .wvc-recipe-counter-circle {
			background:$accent_color;
		}

		.accent-color-light .category-label{
			//color:#333!important;
		}

		.accent-color-dark .category-label{
			//color:#fff!important;
		}

		.coupon .button:hover{
			background:$accent_color!important;
			border-color:$accent_color!important;
		}

		.menu-item-fill{
			background:$accent_color!important;
		}

		.audio-shortcode-container .mejs-container .mejs-controls > .mejs-playpause-button{
			background:$accent_color;
		}

		.menu-hover-style-h-underline .nav-menu-desktop li a span.menu-item-text-container:after{
			background-color:$accent_color!important;
		}

		ul.wc-tabs li:hover:after,
		ul.wc-tabs li.ui-tabs-active:after,
		ul.wc-tabs li.active:after,
		ul.wvc-tabs-menu li:hover:after,
		ul.wvc-tabs-menu li.ui-tabs-active:after,
		ul.wvc-tabs-menu li.active:after
		{
			color:$accent_color!important;
		}

		.wvc-font-dark ul.wvc-tabs-menu li.ui-tabs-active,
		.wvc-font-light ul.wvc-tabs-menu li.ui-tabs-active{
			box-shadow: inset 0 -3px 0 0 $accent_color!important;
		}

		.wvc-accordion-tab.ui-state-active .wvc-at-title-text,
		.wvc-accordion-tab.ui-state-active:hover .wvc-at-title-text{
			color:$accent_color!important;
		}

		/*.entry-product ins .woocommerce-Price-amount,
		.entry-single-product ins .woocommerce-Price-amount{
			color:$accent_color;
		}*/
	";

	$heading_selectors = apply_filters( 'tattoopress_heading_selectors', tattoopress_list_to_array( 'h1:not(.wvc-bigtext), h2:not(.wvc-bigtext), h3:not(.wvc-bigtext), h4:not(.wvc-bigtext), h5:not(.wvc-bigtext), .post-title, .entry-title, h2.entry-title > .entry-link, h2.entry-title, .widget-title, .wvc-counter-text, .wvc-countdown-period, .location-title, .logo-text, .wvc-interactive-links, .wvc-interactive-overlays, .heading-font' ) );

	$heading_selectors = tattoopress_array_to_list( $heading_selectors );
	$output           .= "$heading_selectors{text-rendering: auto;}";

	// If dark
	if ( preg_match( '/dark/', tattoopress_get_theme_mod( 'color_scheme' ) ) ) {
		$output .= ".wvc-background-color-default.wvc-font-light{
			background-color:$page_background_color;
		}";
	}

	// if light
	if ( preg_match( '/light/', tattoopress_get_theme_mod( 'color_scheme' ) ) ) {
		$output .= ".wvc-background-color-default.wvc-font-dark{
			background-color:$page_background_color;
		}";
	}

	return $output;
}
add_filter( 'tattoopress_color_scheme_output', 'tattoopress_edit_color_scheme_css', 10, 2 );

/**
 * Additional styles
 */
function tattoopress_output_additional_styles() {

	$output = '';

	/* Content inner background */
	$c_ci_bg_color = tattoopress_get_inherit_mod( 'content_inner_bg_color' );

	if ( $c_ci_bg_color ) {
		$output .= ".content-inner{
	background-color: $c_ci_bg_color;
}";
	}

	/* Product thumbnail padding */
	$p_t_padding = tattoopress_get_inherit_mod( 'product_thumbnail_padding' );

	if ( $p_t_padding ) {
		$p_t_padding = tattoopress_sanitize_css_value( $p_t_padding );
		$output     .= ".entry-product-masonry .product-thumbnail-container,
.entry-product-grid .product-thumbnail-container,
.wwcq-product-quickview-container .product-images .slide-content img{
	padding: $p_t_padding;
}";
	}

	$output .= '.wolf-share-buttons-container:before{
	content: "' . esc_html__( 'Share', 'tattoopress' ) . ':";

}';

	// $output .= '#back-to-top:before{
	// content: "' . esc_html__( 'top', 'tattoopress' ) . '";
	//
	// }';

	if ( ! SCRIPT_DEBUG ) {
		$output = tattoopress_compact_css( $output );
	}

	wp_add_inline_style( 'tattoopress-style', $output );
}
add_action( 'wp_enqueue_scripts', 'tattoopress_output_additional_styles', 999 );

/*
--------------------------------------------------------------------

	POST HOOKS

----------------------------------------------------------------------
*/

/**
 * Redefine post standard hook
 */
function tattoopress_remove_loop_post_default_hooks() {

	remove_action( 'tattoopress_before_post_content_standard_title', 'tattoopress_output_post_content_standard_date' );
	remove_action( 'tattoopress_post_content_standard_title', 'tattoopress_output_post_content_standard_title' );
	remove_action( 'tattoopress_after_post_content_standard', 'tattoopress_output_post_content_standard_meta' );

	remove_action( 'tattoopress_before_post_content_grid_title', 'tattoopress_output_post_content_grid_date' );
	remove_action( 'tattoopress_before_post_content_grid_title', 'tattoopress_output_post_content_grid_media' );
	remove_action( 'tattoopress_post_content_grid_title', 'tattoopress_output_post_grid_title' );

	remove_action( 'tattoopress_before_post_content_masonry_title', 'tattoopress_output_post_content_grid_date' );
	remove_action( 'tattoopress_before_post_content_masonry_title', 'tattoopress_output_post_content_grid_media' );
	remove_action( 'tattoopress_post_content_masonry_title', 'tattoopress_output_post_grid_title' );

	remove_action( 'tattoopress_after_post_content_grid', 'tattoopress_output_post_content_grid_meta' );
	remove_action( 'tattoopress_after_post_content_masonry', 'tattoopress_output_post_content_grid_meta' );

	remove_action( 'tattoopress_after_post_content_grid_title', 'tattoopress_output_post_content_grid_excerpt' );
	remove_action( 'tattoopress_after_post_content_masonry_title', 'tattoopress_output_post_content_grid_excerpt' );

	// Add title
	add_action( 'tattoopress_before_post_content_standard_title', 'tattoopress_overwrite_post_standard_title', 10, 2 );

	add_action( 'tattoopress_before_post_content_masonry', 'tattoopress_output_post_content_grid_custom_media', 10, 2 );
	add_action( 'tattoopress_before_post_content_masonry_title', 'tattoopress_output_post_content_grid_open_tag', 10, 1 );

	add_action( 'tattoopress_before_post_content_grid', 'tattoopress_output_post_content_grid_custom_media', 10, 2 );
	add_action( 'tattoopress_before_post_content_grid', 'tattoopress_output_post_content_grid_summary_open_tag', 10, 2 );
	add_action( 'tattoopress_post_content_grid_title', 'tattoopress_overwrite_post_standard_title', 10, 2 );
	add_action( 'tattoopress_after_post_content_grid_title', 'tattoopress_overwrite_post_content_grid_excerpt', 10, 2 );

	add_action( 'tattoopress_post_content_masonry_title', 'tattoopress_overwrite_post_standard_title', 10, 2 );

	// add_action( 'tattoopress_before_post_content_grid_title', 'tattoopress_output_post_content_grid_open_tag', 10, 1 );

	add_action( 'tattoopress_after_post_content_masonry_title', 'tattoopress_overwrite_post_content_grid_excerpt', 10, 2 );

	add_action( 'tattoopress_after_post_content_grid', 'tattoopress_output_post_content_grid_summary_close_tag', 10, 1 );
	add_action( 'tattoopress_after_post_content_masonry', 'tattoopress_output_post_content_grid_summary_close_tag', 10, 1 );

	add_action( 'tattoopress_after_post_content_standard', 'tattoopress_output_post_content_standard_inner_close_tag', 10, 1 );
}
add_action( 'init', 'tattoopress_remove_loop_post_default_hooks' );

/**
 * Post open tag
 */
function tattoopress_output_post_content_grid_summary_open_tag( $post_display_elements ) {
	?>
	<div class="entry-summary">
		<div class="entry-summary-inner">
	<?php
}

/**
 * Post close tag
 */
function tattoopress_output_post_content_grid_summary_close_tag( $post_display_elements ) {
	?>
		</div><!-- .entry-summary-inner -->
	</div><!-- .entry-summary -->
	<?php
}

/**
 * Post standard inner close tag
 */
function tattoopress_output_post_content_standard_inner_close_tag() {
	?>
	</div><!-- .entry-post-standard-inner -->
	<?php
}

/**
 * Post Media
 */
function tattoopress_output_post_content_grid_custom_media( $post_display_elements, $display ) {
	$show_thumbnail = ( in_array( 'show_thumbnail', $post_display_elements, true ) );
	$show_category  = ( in_array( 'show_category', $post_display_elements, true ) );
	$format         = get_post_format();
	$post_id        = get_the_ID();

	?>
	<?php if ( $show_thumbnail ) : ?>
		<?php if ( tattoopress_has_post_thumbnail() || tattoopress_is_instagram_post( $post_id ) ) : ?>
			<div class="entry-image">
				<?php if ( $show_category ) : ?>
					<a class="category-label" href="<?php echo esc_url(tattoopress_get_first_category_url()); ?>"><?php echo tattoopress_get_first_category(); ?></a>
				<?php endif; ?>
				<?php
				if ( 'masonry' === $display ) {

					tattoopress_get_post_masonry_media();

				} else {
					?>
						<div class="entry-cover">
						<?php
							echo tattoopress_background_img( array( 'background_img_size' => 'medium' ) );
						?>
						</div><!-- entry-cover -->
						<?php
				}
				?>
			</div><!-- .entry-image -->
		<?php endif; ?>
	<?php endif; ?>
	<?php
}

/**
 * Get media for post masonry display
 */
function tattoopress_get_post_masonry_media() {

	$format  = get_post_format();
	$post_id = get_the_ID();

	// if ( 141 === $post_id ) {
	// debug( tattoopress_featured_media( $post_id ) );
	// die();
	// }

	if ( 'video' === $format ) {

		echo tattoopress_featured_media( $post_id );

	} elseif ( 'image' === $format && tattoopress_is_instagram_post( $post_id ) ) {

		echo tattoopress_get_instagram_image( $post_id );

	} elseif ( 'image' === $format ) {

		echo tattoopress_post_thumbnail( 'tattoopro-masonry' );

	} elseif ( 'gallery' === $format && tattoopress_background_slideshow() ) {

		echo tattoopress_background_slideshow(
			array(
				'slideshow_image_size' => '447x250',
				'slideshow_img_count'  => 3,
			)
		);

		?>
		<div class="slideshow-gallery-direction-nav">
			<a href="#" class="slideshow-gallery-direction-nav-prev">
				<span class="slideshow-gallery-direction-nav-prev-icon"></span>
			</a>
			<a href="#" class="slideshow-gallery-direction-nav-next">
				<span class="slideshow-gallery-direction-nav-next-icon"></span>
			</a>
		</div>
		<?php

	} elseif ( 'audio' === $format && tattoopress_featured_media() ) {

		echo tattoopress_featured_media();

	} else {
		?>
		<div class="entry-cover">
			<?php
				echo tattoopress_background_img( array( 'background_img_size' => 'medium' ) );
			?>
		</div><!-- entry-cover -->
		<?php
	}
}

/**
 * Re-assign post masonry open hook
 */
function tattoopress_output_post_content_grid_open_tag( $post_display_elements ) {
	$show_date      = ( in_array( 'show_date', $post_display_elements ) );
	$show_thumbnail = ( in_array( 'show_thumbnail', $post_display_elements ) );
	?>
	<div class="entry-summary">
		<div class="entry-summary-inner">
	<?php
}

/**
 * Post Text
 */
function tattoopress_overwrite_post_content_grid_excerpt( $post_display_elements, $post_excerpt_length, $display = 'grid' ) {

	$show_text = ( in_array( 'show_text', $post_display_elements ) );

	$post_excerpt_length = 8;

	if ( 'metro' === $display ) {
		$post_excerpt_length = 5;
	}
	?>
	<?php if ( $show_text ) : ?>
		<div class="entry-excerpt">
			<?php do_action( 'tattoopress_post_' . $display . '_excerpt', $post_excerpt_length ); ?>
		</div><!-- .entry-excerpt -->
	<?php endif; ?>
	<?php
}

/**
 * Redefine single post hook
 */
function tattoopress_remove_single_post_default_hooks() {

	/**
	 * Remove default Hooks
	 */
	remove_action( 'tattoopress_post_content_start', 'tattoopress_add_custom_post_meta' );
	remove_action( 'tattoopress_post_content_end', 'tattoopress_ouput_single_post_taxonomy' );
	remove_action( 'tattoopress_related_post_content', 'tattoopress_output_related_post_content' );

	/**
	 * Add new hooks
	 */
	add_action( 'tattoopress_post_content_before', 'tattoopress_output_single_post_featured_image' );
	add_action( 'tattoopress_post_content_before', 'tattoopress_output_single_post_meta', 10, 1 );

}
add_action( 'init', 'tattoopress_remove_single_post_default_hooks' );

/**
 * Output single post meta
 */
function tattoopress_output_single_post_meta() {
	?>
	<div class="entry-meta">
		<span class="entry-date">
			<?php tattoopress_entry_date( true, true ); ?>
		</span>
			<?php tattoopress_get_author_avatar(); ?>
		<span class="entry-category-list">
			<?php echo apply_filters( 'tattoopress_entry_category_list_icon', '<span class="meta-icon category-icon"></span>' ); ?>
			<?php echo get_the_term_list( get_the_ID(), 'category', '', esc_html__( ', ', 'tattoopress' ), '' ); ?>
		</span>
		<?php tattoopress_entry_tags(); ?>
		<?php tattoopress_get_extra_meta(); ?>
		<?php tattoopress_edit_post_link(); ?>
	</div><!-- .entry-meta -->
	<?php
}

/**
 * Single Post Featured Image
 */
function tattoopress_output_single_post_featured_image() {

	if ( tattoopress_get_inherit_mod( 'hide_single_post_featured_image' ) ) {
		return;
	}

	?>
	<div class="single-featured-image">
	<?php
	the_post_thumbnail( 'large' );
	?>
	</div>
	<?php

}

add_filter(
	'tattoopress_entry_tag_list_separator',
	function() {
		return ', ';
	}
);

/**
 * Output single post pagination
 */
function tattoopress_output_custom_single_post_pagination() {

	if ( ! is_singular( 'post' ) || 'no' === tattoopress_get_inherit_mod( 'single_post_nav' ) ) {
		return; // event are ordered by custom date so it's better to hide the pagination
	}

	global $post;

	// Don't print empty markup if there's nowhere to navigate.
	$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
	$next     = get_adjacent_post( false, '', false );

	if ( ! $next && ! $previous || ! is_single() || 'wvc_content_block' === get_post_type() ) {
		return;
	}

	$prev_post = get_previous_post();
	$next_post = get_next_post();

	$prev_post_id = ( is_object( $prev_post ) && isset( $prev_post->ID ) ) ? $prev_post->ID : null;
	$next_post_id = ( is_object( $next_post ) && isset( $next_post->ID ) ) ? $next_post->ID : null;

	$prev_post_featured_img_id = ( $prev_post_id ) ? get_post_thumbnail_id( $prev_post_id ) : null;
	$next_post_featured_img_id = ( $next_post_id ) ? get_post_thumbnail_id( $next_post_id ) : null;

	$index_class = 'nav-index';
	$prev_class  = 'nav-previous';
	$next_class  = 'nav-next';
	?>
	<nav class="tattoopress-single-post-pagination clearfix">
		<?php if ( $prev_post ) : ?>
			<div class="single-post-nav-item post-previous">
				<a href="<?php echo esc_url( get_permalink( $prev_post_id ) ); ?>" class="post-nav-link-overlay"></a>
				<div class="entry-cover">
						<?php echo tattoopress_background_img( array( 'background_img' => $prev_post_featured_img_id ) ); ?></div>
				<div class="post-nav-content">
					<div class="post-nav-summary">
						<?php if ( tattoopress_get_first_category( $prev_post_id ) ) : ?>
							<div class="post-nav-category"><?php echo tattoopress_get_first_category( $prev_post_id ); ?></div>
						<?php endif; ?>
						<div class="post-nav-title"><?php echo get_the_title( $prev_post_id ); ?></div>
						<span class="post-nav-entry-date">
							<?php tattoopress_entry_date( true, '', $prev_post_id ); ?>
						</span>
					</div>
				</div>
				<?php previous_post_link( '%link', '<span class="nav-label">' . esc_html__( 'Previous Article', 'tattoopress' ) . ' </span>' ); ?>
			</div><!-- .nav-previous -->
		<?php endif; ?>
		<?php if ( $next_post ) : ?>
			<div class="single-post-nav-item post-next">
				<a href="<?php echo esc_url( get_permalink( $next_post_id ) ); ?>" class="post-nav-link-overlay"></a>
				<div class="entry-cover">
					<?php echo tattoopress_background_img( array( 'background_img' => $next_post_featured_img_id ) ); ?>
					</div>
				<div class="post-nav-content">
					<div class="post-nav-summary">
						<?php if ( tattoopress_get_first_category( $next_post_id ) ) : ?>
							<div class="post-nav-category"><?php echo tattoopress_get_first_category( $next_post_id ); ?></div>
						<?php endif; ?>
						<div class="post-nav-title"><?php echo get_the_title( $next_post_id ); ?></div>
						<span class="post-nav-entry-date">
							<?php tattoopress_entry_date( true, '', $next_post_id ); ?>
						</span>
					</div>
				</div>
				<?php next_post_link( '%link', '<span class="nav-label">' . esc_html__( 'Next Article', 'tattoopress' ) . ' </span>' ); ?>
			</div><!-- .nav-next -->
		<?php endif; ?>
	</nav><!-- .single-post-pagination -->
	<?php
}
add_action( 'tattoopress_post_content_after', 'tattoopress_output_custom_single_post_pagination', 14 );

/**
 * Output related posts
 */
function tattoopress_overwrite_related_post_content() {
	?>
	<div class="entry-related-post">
		<a href="<?php the_permalink(); ?>" class="entry-related-post-img-link">
			<?php the_post_thumbnail( apply_filters( 'tattoopress_related_post_thumbnail_size', 'thumbnail' ) ); ?>
		</a>
		<div class="entry-related-post-summary">
			<a href="<?php the_permalink(); ?>" class="entry-related-post-title-link">
				<?php the_title( '<h4 class="entry-title">', '</h4>' ); ?>
			</a>
			<!-- <a class="entry-related-post-category" href="<?php // echo tattoopress_get_first_category_url(); ?>"><?php // echo tattoopress_get_first_category(); ?></a> -->
			<span class="entry-related-post-entry-date">
				<?php tattoopress_entry_date(); ?>
			</span>
		</div><!-- .entry-summary -->
	</div><!-- .entry-box -->
	<?php
}
add_action( 'tattoopress_related_post_content', 'tattoopress_overwrite_related_post_content' );

/**
 * Add post meta before title
 */
function tattoopress_overwrite_post_standard_title( $post_display_elements, $display ) {

	if ( 'standard' === $display ) {
		echo '<div class="entry-post-standard-inner">';
	}

	if ( '' == get_post_format() || 'video' === get_post_format() || 'gallery' === get_post_format() || 'image' === get_post_format() || 'audio' === get_post_format() || 'grid' === $display || 'masonry' === $display ) {
		the_title( '<h2 class="entry-title"><a class="entry-link" href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
	}

	echo '<header class="entry-meta">';

	if ( in_array( 'show_date', $post_display_elements ) && '' == get_post_format() || 'video' === get_post_format() || 'gallery' === get_post_format() || 'image' === get_post_format() || 'audio' === get_post_format() || 'grid' === $display || 'masonry' === $display ) {
		?>
		<span class="entry-date">
			<?php tattoopress_entry_date( true, true ); ?>
		</span>
		<?php
	}

	$show_author     = ( in_array( 'show_author', $post_display_elements ) );
	$show_category   = ( in_array( 'show_category', $post_display_elements ) );
	$show_tags       = ( in_array( 'show_tags', $post_display_elements ) );
	$show_extra_meta = ( in_array( 'show_extra_meta', $post_display_elements ) );
	?>
	<?php if ( ( $show_author || $show_extra_meta || $show_category || tattoopress_edit_post_link( false ) ) && 'grid' === $display || 'masonry' === $display || ( ! tattoopress_is_short_post_format() && 'standard' === $display ) ) : ?>

			<?php if ( $show_author ) : ?>
				<?php tattoopress_get_author_avatar(); ?>
			<?php endif; ?>
			<?php if ( $show_category ) : ?>
				<span class="entry-category-list">
					<?php echo apply_filters( 'tattoopress_entry_category_list_icon', '<span class="meta-icon category-icon"></span>' ); ?>
					<?php echo get_the_term_list( get_the_ID(), 'category', '', esc_html__( ', ', 'tattoopress' ), '' ); ?>
				</span>
			<?php endif; ?>
			<?php if ( $show_tags ) : ?>
				<?php tattoopress_entry_tags(); ?>
			<?php endif; ?>
			<?php if ( $show_extra_meta ) : ?>
				<?php tattoopress_get_extra_meta(); ?>
			<?php endif; ?>
			<?php tattoopress_edit_post_link(); ?>
		<?php endif; ?>
	<?php
	echo '</header>';
}

add_filter(
	'tattoopress_author_heading_avatar_size',
	function() {
		return 150;
	}
);
add_filter(
	'tattoopress_author_box_avatar_size',
	function() {
		return 150;
	}
);

/**
 * Post excerpt read more
 */
function tattoopress_output_post_grid_classic_excerpt_read_more() {
	?>
	<p class="post-grid-read-more-container"><a href="<?php the_permalink(); ?>" class="<?php echo esc_attr( apply_filters( 'tattoopress_more_link_button_class', 'more-link' ) ); ?>"><small class="wvc-button-background-fill"></small><span><?php esc_html_e( 'read more', 'tattoopress' ); ?></span></a></p>
	<?php
}
add_action( 'tattoopress_post_grid_excerpt', 'tattoopress_output_post_grid_classic_excerpt_read_more', 44 );
add_action( 'tattoopress_post_masonry_excerpt', 'tattoopress_output_post_grid_classic_excerpt_read_more', 44 );
add_action( 'tattoopress_post_search_excerpt', 'tattoopress_output_post_grid_classic_excerpt_read_more', 44 );

/*
--------------------------------------------------------------------

	WVC FILTERS

----------------------------------------------------------------------
*/

/**
 * Add custom elements to theme
 *
 * @param array $elements
 * @return  array $elements
 */
function tattoopress_add_available_wvc_elements( $elements ) {

	if ( class_exists( 'WooCommerce' ) ) {
		$elements[] = 'wc-searchform';
		$elements[] = 'login-form';
		$elements[] = 'product-presentation';
	}

	if ( class_exists( 'Wolf_Videos' ) ) {
		$elements[] = 'video-switcher';
	}

	return $elements;
}
add_filter( 'wvc_element_list', 'tattoopress_add_available_wvc_elements', 44 );

/**
 * Filter heading attribute
 *
 * @param array $atts
 * @return array $atts
 */
function woltheme_filter_heading_atts( $atts ) {

	// heading
	if ( isset( $atts['style'] ) ) {
		$atts['el_class'] = $atts['el_class'] . ' ' . $atts['style'];
	}

	return $atts;
}
add_filter( 'wvc_heading_atts', 'woltheme_filter_heading_atts' );

/**
 * Remove some params
 */
function tattoopress_remove_vc_params() {

	if ( function_exists( 'vc_remove_param' ) ) {

		vc_remove_param( 'wvc_product_index', 'product_layout' );
		vc_remove_param( 'wvc_product_index', 'product_display' );
		vc_remove_param( 'wvc_product_index', 'product_metro_pattern' );
		vc_remove_param( 'wvc_product_index', 'product_text_align' );
		vc_remove_param( 'wvc_video_index', 'video_preview' );

		vc_remove_param( 'wvc_interactive_links', 'align' );
		vc_remove_param( 'wvc_interactive_links', 'v_align' );
		vc_remove_param( 'wvc_interactive_links', 'display' );
		vc_remove_param( 'wvc_interactive_overlays', 'align' );
		vc_remove_param( 'wvc_interactive_overlays', 'display' );
		vc_remove_param( 'wvc_interactive_overlays', 'font_size' );

		vc_remove_param( 'wvc_team_member', 'layout' );
		vc_remove_param( 'wvc_team_member', 'alignment' );
		vc_remove_param( 'wvc_team_member', 'v_alignment' );
		vc_remove_param( 'wvc_team_member', 'overlay_color' );
		vc_remove_param( 'wvc_team_member', 'overlay_custom_color' );
		vc_remove_param( 'wvc_team_member', 'overlay_text_color' );
		vc_remove_param( 'wvc_team_member', 'overlay_text_custom_color' );
		vc_remove_param( 'wvc_team_member', 'overlay_opacity' );
		vc_remove_param( 'wvc_team_member', 'caption_v_align' );

		vc_remove_param( 'wvc_testimonial_slider', 'text_alignment' );
	}
}
add_action( 'init', 'tattoopress_remove_vc_params' );

/**
 * Post slider button text markup
 */
add_filter(
	'wvc_last_posts_big_slide_button_text',
	function( $text ) {
		return '<span>' . $text . '</span>';
	}
);

/**
 * Interactive links
 */
add_filter(
	'wvc_interactive_links_align',
	function( $value ) {
		return 'center';
	},
	44
);

add_filter(
	'wvc_interactive_links_display',
	function( $value ) {
		return 'inline-block';
	},
	100
);

/**
 * Album disc
 */
add_filter(
	'wvc_default_album_disc_rotation_speed',
	function() {
		return 10000;
	}
);

/**
 * Set breadcrumb delimiter
 */
function tattoopress_set_breadcrump_delimiter( $string ) {

	return ' <i class="fa ion-chevron-right"></i> ';

}
add_filter( 'wvc_breadcrumb_delimiter', 'tattoopress_set_breadcrump_delimiter' );

/**
 * Filter fullPage Transition
 *
 * @return array
 */
function tattoopress_set_fullpage_transition( $transition ) {

	if ( is_page() || is_single() ) {
		if ( get_post_meta( wvc_get_the_ID(), '_post_fullpage', true ) ) {
			$transition = get_post_meta( wvc_get_the_ID(), '_post_fullpage_transition', true );
		}
	}

	return $transition;
}
add_filter( 'wvc_fp_transition_effect', 'tattoopress_set_fullpage_transition' );

/**
 * Set overlay effects
 *
 * @param array $atts
 * @return string $html
 */
function tattoopress_set_bg_effects( $atts ) {

	if ( isset( $atts['add_filmgrain'] ) || isset( $atts['add_grunge'] ) ) {
		$atts['add_effect'] = true;
	}

	return $atts;
}
add_filter( 'wvc_row_atts', 'tattoopress_set_bg_effects' );
add_filter( 'wvc_row_inner_atts', 'tattoopress_set_bg_effects' );
add_filter( 'wvc_column_atts', 'tattoopress_set_bg_effects' );
add_filter( 'wvc_column_inner_atts', 'tattoopress_set_bg_effects' );
add_filter( 'wvc_advanced_slider_atts', 'tattoopress_set_bg_effects' );
add_filter( 'wvc_interactive_link_item_bg_atts', 'tattoopress_set_bg_effects' );

/**
 * Get row overlay effects
 *
 * @param string $html
 * @param array  $atts
 * @return string $html
 */
function tattoopress_get_overlay_effects( $html, $atts ) {

	if ( isset( $atts['add_filmgrain'] ) && $atts['add_filmgrain'] ) {
		ob_start();
		?>
		<div class="tattoopress-bg-filmgrain"></div>
		<?php
		$html .= ob_get_clean();
	}

	if ( isset( $atts['add_grunge'] ) && $atts['add_grunge'] ) {
		ob_start();
		?>
		<div class="tattoopress-bg-grunge"></div>
		<?php
		$html .= ob_get_clean();
	}

	return $html;
}
add_filter( 'wvc_background_effect', 'tattoopress_get_overlay_effects', 10, 2 );


/*
--------------------------------------------------------------------

	WC FILTERS

----------------------------------------------------------------------
*/

/**
 * Quickview product excerpt lenght
 */
add_filter(
	'wwcqv_excerpt_length',
	function() {
		return 28;
	}
);

/**
 * After quickview summary hook
 */
add_action(
	'wwcqv_product_summary',
	function() {
		?>
	<div class="single-add-to-wishlist">
		<span class="single-add-to-wishlist-label"><?php esc_html_e( 'Wishlist', 'tattoopress' ); ?></span>
		<?php tattoopress_add_to_wishlist(); ?>
	</div><!-- .single-add-to-wishlist -->
		<?php
	},
	20
);



/**
 * Display sale label condition
 *
 * @param bool $bool
 * @return bool
 */
function tattoopress_do_show_sale_label( $bool ) {

	if ( get_post_meta( get_the_ID(), '_post_product_label', true ) ) {
		$bool = true;
	}

	return $bool;
}
add_filter( 'tattoopress_show_sale_label', 'tattoopress_do_show_sale_label' );

/**
 * Sale label text
 *
 * @param string $string
 * @return string
 */
function tattoopress_sale_label( $string ) {

	if ( get_post_meta( get_the_ID(), '_post_product_label', true ) ) {

		$style = '';

		$string = '<span' . $style . ' class="onsale">' . esc_attr( get_post_meta( get_the_ID(), '_post_product_label', true ) ) . '</span>';
	}

	return $string;
}
add_filter( 'woocommerce_sale_flash', 'tattoopress_sale_label' );

/**
 * Product quickview button
 *
 * @param string $string
 * @return string
 */
function tattoopress_output_product_quickview_button() {

	if ( function_exists( 'wolf_quickview_button' ) ) {
		wolf_quickview_button();
	}
}
add_filter( 'tattoopress_product_quickview_button', 'tattoopress_output_product_quickview_button' );

/**
 * Product wishlist button
 *
 * @param string $string
 * @return string
 */
function tattoopress_output_product_wishlist_button() {

	if ( function_exists( 'wolf_add_to_wishlist' ) ) {
		wolf_add_to_wishlist();
	}
}
add_filter( 'tattoopress_add_to_wishlist_button', 'tattoopress_output_product_wishlist_button' );

/**
 * Product Add to cart button
 *
 * @param string $string
 * @return string
 */
function tattoopress_output_product_add_to_cart_button() {

	global $product;

	if ( $product->is_type( 'variable' ) ) {

		echo '<a class="product-quickview-button" href="' . esc_url( get_permalink() ) . '"><span class="fa quickview-product-add-to-cart-icon" title="' . esc_attr( __( 'Select option', 'tattoopress' ) ) . '"></span></a>';

	} elseif ( $product->is_type( 'external' ) || $product->is_type( 'grouped' ) ) {

		echo '<a class="product-quickview-button" href="' . esc_url( get_permalink() ) . '"><span class="fa quickview-product-add-to-cart-icon" title="' . esc_attr( __( 'View product', 'tattoopress' ) ) . '"></span></a>';

	} else {

		echo tattoopress_add_to_cart(
			get_the_ID(),
			'quickview-product-add-to-cart product-quickview-button',
			'<span class="fa quickview-product-add-to-cart-icon" title="' . esc_attr( __( 'Add to cart', 'tattoopress' ) ) . '"></span>'
		);
	}
}
add_filter( 'tattoopress_product_add_to_cart_button', 'tattoopress_output_product_add_to_cart_button' );

/**
 * Product more button
 *
 * @param string $string
 * @return string
 */
function tattoopress_output_product_more_button() {

	?>
	<a class="product-quickview-button product-more-button" href="<?php the_permalink(); ?>" title="<?php esc_attr_e( 'More details', 'tattoopress' ); ?>"><span class="fa ion-android-more-vertical"></span></a>
	<?php
}
add_filter( 'tattoopress_product_more_button', 'tattoopress_output_product_more_button' );

/*
--------------------------------------------------------------------

	WC HOOKS

----------------------------------------------------------------------
*/

/**
 * Product Size Chart Image
 */
function tattoopress_product_size_chart_img() {

	$hide_sizechart = get_post_meta( get_the_ID(), '_post_wc_product_hide_size_chart_img', true );

	if ( $hide_sizechart || ! is_singular( 'product' ) ) {
		return;
	}

	global $post;
	$sc_img = null;
	$terms  = get_the_terms( $post, 'product_cat' );

	foreach ( $terms as $term ) {

		$sizechart_id = absint( get_term_meta( $term->term_id, 'sizechart_id', true ) );

		if ( $sizechart_id ) {
			$sc_img = $sizechart_id;
		}
	}

	if ( get_post_meta( get_the_ID(), '_post_wc_product_size_chart_img', true ) ) {
		$sc_img = get_post_meta( get_the_ID(), '_post_wc_product_size_chart_img', true );
	}

	if ( is_single() && $sc_img ) {
		$href = tattoopress_get_url_from_attachment_id( $sc_img, 'tattoopro-XL' );
		?>
		<div class="size-chart-img">
			<a href="<?php echo esc_url( $href ); ?>" class="lightbox"><?php esc_html_e( 'Size Chart', 'tattoopress' ); ?></a>
		</div>
		<?php
	}
}
add_action( 'woocommerce_single_product_summary', 'tattoopress_product_size_chart_img', 25 );

/**
 * WC gallery image size overwrite
 */
add_filter(
	'woocommerce_gallery_thumbnail_size',
	function( $size ) {
		return array( 100, 137 );
	},
	40
);

/**
 * Category thumbnail fields.
 */
function tattoopress_add_category_fields() {
	?>
	<div class="form-field term-thumbnail-wrap">
		<label><?php esc_html_e( 'Size Chart', 'tattoopress' ); ?></label>
		<div id="sizechart_img" style="float: left; margin-right: 10px;"><img src="<?php echo esc_url( wc_placeholder_img_src() ); ?>" width="60px" height="60px" /></div>
		<div style="line-height: 60px;">
			<input type="hidden" id="product_cat_sizechart_img_id" name="product_cat_sizechart_img_id">
			<button type="button" id="upload_sizechart_image_button" class="upload_sizechart_image_button button"><?php esc_html_e( 'Upload/Add image', 'tattoopress' ); ?></button>
				<button type="button" id="remove_sizechart_image_button" class="remove_sizechart_image_button button" style="display:none;"><?php esc_html_e( 'Remove image', 'tattoopress' ); ?></button>
		</div>
		<script type="text/javascript">

			// Only show the "remove image" button when needed
			if ( ! jQuery( '#product_cat_sizechart_img_id' ).val() ) {
				jQuery( '#remove_sizechart_image_button' ).hide();
			}

			// Uploading files
			var sizechart_frame;

			jQuery( document ).on( 'click', '#upload_sizechart_image_button', function( event ) {

				event.preventDefault();

				// If the media frame already exists, reopen it.
				if ( sizechart_frame ) {
					sizechart_frame.open();
					return;
				}

				// Create the media frame.
				sizechart_frame = wp.media.frames.downloadable_file = wp.media({
					title: '<?php esc_html_e( 'Choose an image', 'tattoopress' ); ?>',
					button: {
						text: '<?php esc_html_e( 'Use image', 'tattoopress' ); ?>'
					},
					multiple: false
				} );

				// When an image is selected, run a callback.
				sizechart_frame.on( 'select', function() {
					var attachment           = sizechart_frame.state().get( 'selection' ).first().toJSON();
					var attachment_thumbnail = attachment.sizes.thumbnail || attachment.sizes.full;

					jQuery( '#product_cat_sizechart_img_id' ).val( attachment.id );
					jQuery( '#sizechart_img' ).find( 'img' ).attr( 'src', attachment_thumbnail.url );
					jQuery( '#remove_sizechart_image_button' ).show();
				} );

				// Finally, open the modal.
				sizechart_frame.open();
			} );

			jQuery( document ).on( 'click', '#remove_sizechart_image_button', function() {
				jQuery( '#sizechart_img' ).find( 'img' ).attr( 'src', '<?php echo esc_js( wc_placeholder_img_src() ); ?>' );
				jQuery( '#product_cat_sizechart_img_id' ).val( '' );
				jQuery( '#remove_sizechart_image_button' ).hide();
				return false;
			} );

			jQuery( document ).ajaxComplete( function( event, request, options ) {
				if ( request && 4 === request.readyState && 200 === request.status
					&& options.data && 0 <= options.data.indexOf( 'action=add-tag' ) ) {

					var res = wpAjax.parseAjaxResponse( request.responseXML, 'ajax-response' );
					if ( ! res || res.errors ) {
						return;
					}
					// Clear Thumbnail fields on submit
					jQuery( '#sizechart_img' ).find( 'img' ).attr( 'src', '<?php echo esc_js( wc_placeholder_img_src() ); ?>' );
					jQuery( '#product_cat_sizechart_img_id' ).val( '' );
					jQuery( '#remove_sizechart_image_button' ).hide();
					// Clear Display type field on submit
					jQuery( '#display_type' ).val( '' );
					return;
				}
			} );

		</script>
		<div class="clear"></div>
	</div>
	<?php
}
add_action( 'product_cat_add_form_fields', 'tattoopress_add_category_fields', 100 );

/**
 * Edit category thumbnail field.
 *
 * @param mixed $term Term (category) being edited
 */
function tattoopress_edit_category_fields( $term ) {

	$sizechart_id = absint( get_term_meta( $term->term_id, 'sizechart_id', true ) );

	if ( $sizechart_id ) {
		$image = wp_get_attachment_thumb_url( $sizechart_id );
	} else {
		$image = wc_placeholder_img_src();
	}
	?>
	<tr class="form-field">
		<th scope="row" valign="top"><label><?php esc_html_e( 'Size Chart', 'tattoopress' ); ?></label></th>
		<td>
			<div id="sizechart_img" style="float: left; margin-right: 10px;"><img src="<?php echo esc_url( $image ); ?>" width="60px" height="60px" /></div>
			<div style="line-height: 60px;">
				<input type="hidden" id="product_cat_sizechart_img_id" name="product_cat_sizechart_img_id" value="<?php echo absint( $sizechart_id ); ?>" />
				<button type="button" id="upload_sizechart_image_button" class="upload_sizechart_image_button button"><?php esc_html_e( 'Upload/Add image', 'tattoopress' ); ?></button>
				<button type="button" id="remove_sizechart_image_button" class="remove_sizechart_image_button button" style="display:none;"><?php esc_html_e( 'Remove image', 'tattoopress' ); ?></button>
			</div>
			<script type="text/javascript">

				// Only show the "remove image" button when needed
				if ( jQuery( '#product_cat_sizechart_img_id' ).val() ) {
					jQuery( '#remove_sizechart_image_button' ).show();
				}

				// Uploading files
				var sizechart_frame;

				jQuery( document ).on( 'click', '#upload_sizechart_image_button', function( event ) {

					event.preventDefault();

					// If the media frame already exists, reopen it.
					if ( sizechart_frame ) {
						sizechart_frame.open();
						return;
					}

					// Create the media frame.
					sizechart_frame = wp.media.frames.downloadable_file = wp.media({
						title: '<?php esc_html_e( 'Choose an image', 'tattoopress' ); ?>',
						button: {
							text: '<?php esc_html_e( 'Use image', 'tattoopress' ); ?>'
						},
						multiple: false
					} );

					// When an image is selected, run a callback.
					sizechart_frame.on( 'select', function() {
						var attachment           = sizechart_frame.state().get( 'selection' ).first().toJSON();
						var attachment_thumbnail = attachment.sizes.thumbnail || attachment.sizes.full;

						jQuery( '#product_cat_sizechart_img_id' ).val( attachment.id );
						jQuery( '#sizechart_img' ).find( 'img' ).attr( 'src', attachment_thumbnail.url );
						jQuery( '#remove_sizechart_image_button' ).show();
					} );

					// Finally, open the modal.
					sizechart_frame.open();
				} );

				jQuery( document ).on( 'click', '#remove_sizechart_image_button', function() {
					jQuery( '#sizechart_img' ).find( 'img' ).attr( 'src', '<?php echo esc_js( wc_placeholder_img_src() ); ?>' );
					jQuery( '#product_cat_sizechart_img_id' ).val( '' );
					jQuery( '#remove_sizechart_image_button' ).hide();
					return false;
				} );

			</script>
			<div class="clear"></div>
		</td>
	</tr>
	<?php
}
add_action( 'product_cat_edit_form_fields', 'tattoopress_edit_category_fields', 100 );

/**
 * save_category_fields function.
 *
 * @param mixed  $term_id Term ID being saved
 * @param mixed  $tt_id
 * @param string $taxonomy
 */
function tattoopress_save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {

	if ( isset( $_POST['product_cat_sizechart_img_id'] ) && 'product_cat' === $taxonomy ) {
		update_woocommerce_term_meta( $term_id, 'sizechart_id', absint( $_POST['product_cat_sizechart_img_id'] ) );
	}
}
add_action( 'created_term', 'tattoopress_save_category_fields', 10, 3 );
add_action( 'edit_term', 'tattoopress_save_category_fields', 10, 3 );

/**
 * Single Product Subheading
 */
function tattoopress_add_single_product_subheading() {

	$subheading = get_post_meta( get_the_ID(), '_post_subheading', true );

	if ( is_single() && $subheading ) {
		?>
		<div class="product-subheading">
			<?php echo sanitize_text_field( $subheading ); ?>
		</div>
		<?php
	}

}
add_action( 'woocommerce_single_product_summary', 'tattoopress_add_single_product_subheading', 6 );
add_action( 'wwcqv_product_summary', 'tattoopress_add_single_product_subheading', 6 );

/**
 * Redefine product hook
 */
function tattoopress_remove_loop_item_default_wc_hooks() {

	remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open' );
	remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash' );
	remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail' );
	remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title' );
	remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
	remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price' );
	remove_action( 'woocommerce_after_shop_loop_item', 'www_output_add_to_wishlist_button', 15 );
	remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
	remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );

	add_action( 'woocommerce_before_shop_loop_item', 'tattoopress_wc_loop_thumbnail', 10, 1 );
	add_action( 'woocommerce_after_shop_loop_item', 'tattoopress_wc_loop_summary' );
}
add_action( 'woocommerce_init', 'tattoopress_remove_loop_item_default_wc_hooks' );

/**
 * WC loop thumbnail
 */
function tattoopress_wc_loop_thumbnail( $template_args ) {

	extract(
		wp_parse_args(
			$template_args,
			array(
				'display' => '',
			)
		)
	);

	$product_thumbnail_size = ( 'metro' === $display ) ? 'tattoopro-metro' : 'woocommerce_thumbnail';
	$product_thumbnail_size = apply_filters( 'tattoopress_' . $display . '_thumbnail_size_name', $product_thumbnail_size );
	$product_thumbnail_size = ( tattoopress_is_gif( get_post_thumbnail_id() ) ) ? 'full' : $product_thumbnail_size;
	$product_bg_color       = get_post_meta( get_the_ID(), '_post_product_bg_color', true );
	$product_bg_color       = tattoopress_get_inherit_mod( 'product_bg_color' );
	// $product_bg_color = '#f1f1f1';
	?>
	<div class="product-box">
		<a class="entry-link-mask" href="<?php the_permalink(); ?>"></a>
		<div class="product-thumbnail-container clearfix">
			<?php if ( $product_bg_color ) : ?>
				<div class="product-bg-color" style="background-color:<?php echo esc_attr( $product_bg_color ); ?>"></div>
			<?php endif; ?>
			<div class="product-thumbnail-inner">
				<?php woocommerce_show_product_loop_sale_flash(); ?>
				<?php echo woocommerce_get_product_thumbnail( $product_thumbnail_size ); ?>
				<div class="product-second-thumbnail-bg-color" style="background-color:<?php echo esc_attr( $product_bg_color ); ?>"></div>
				<?php tattoopress_woocommerce_second_product_thumbnail( $product_thumbnail_size ); ?>

			</div><!-- .product-thumbnail-inner -->
		</div><!-- .product-thumbnail-container -->
	<?php
}

function tattoopress_wc_loop_summary() {
	?>
	<div class="product-summary clearfix">
		<div class="product-caption">
			<?php woocommerce_template_loop_product_link_open(); ?>

				<?php woocommerce_template_loop_product_title(); ?>
				<?php
					/**
					 * After title
					 */
					do_action( 'tattoopress_after_shop_loop_item_title' );
				?>
			<?php woocommerce_template_loop_product_link_close(); ?>
			<?php woocommerce_template_loop_price(); ?>
		</div>
		<div class="product-actions">
			<?php
				/**
				 * Quickview button
				 */
				do_action( 'tattoopress_product_quickview_button' );

				/**
				 * Wishlist button
				 */
				do_action( 'tattoopress_add_to_wishlist_button' );
				/**
				 * Add to cart button
				 */
				do_action( 'tattoopress_product_add_to_cart_button' );
			?>
		</div><!-- .product-actions -->
	</div><!-- .product-summary -->

	</div><!-- .product-box -->
	<?php
}

/**
 * Product stacked images + sticky details
 */
function tattoopress_single_product_sticky_layout() {

	if ( ! tattoopress_get_inherit_mod( 'product_sticky' ) || 'no' === tattoopress_get_inherit_mod( 'product_sticky' ) ) {
		return;
	}

	/* Remove default images */
	remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );

	global $product;

	$product_id = $product->get_id();

	echo '<div class="images">';

	woocommerce_show_product_sale_flash();
	/**
	 * If gallery
	 */
	$attachment_ids = $product->get_gallery_image_ids();

	if ( is_array( $attachment_ids ) && ! empty( $attachment_ids ) ) {

		echo '<ul>';

		if ( has_post_thumbnail( $product_id ) ) {

			$caption = get_post_field( 'post_excerpt', get_post_thumbnail_id( $post_thumbnail_id ) );
			?>
			<li class="stacked-image">
				<a class="lightbox" data-fancybox="wc-stacked-images-<?php echo absint( $product_id ); ?>" href="<?php echo get_the_post_thumbnail_url( $product_id, 'full' ); ?>" data-caption="<?php echo esc_attr( $caption ); ?>">
					<?php echo tattoopress_kses( $product->get_image( 'large' ) ); ?>
				</a>
			</li>
			<?php
		}

		foreach ( $attachment_ids as $attachment_id ) {
			if ( wp_attachment_is_image( $attachment_id ) ) {

				$caption = get_post_field( 'post_excerpt', $attachment_id );
				?>
				<li class="stacked-image">
					<a class="lightbox" data-fancybox="wc-stacked-images-<?php echo absint( $product_id ); ?>" href="<?php echo wp_get_attachment_url( $attachment_id, 'full' ); ?>" data-caption="<?php echo esc_attr( $caption ); ?>">
						<?php echo wp_get_attachment_image( $attachment_id, 'large' ); ?>
					</a>
				</li>
				<?php
			}
		}

		echo '</ul>';

		/**
		 * If featured image only
		 */
	} elseif ( has_post_thumbnail( $product_id ) ) {
		?>
		<span class="stacked-image">
			<a class="lightbox" data-fancybox="wc-stacked-images-<?php echo absint( $product_id ); ?>" href="<?php echo get_the_post_thumbnail_url( $product_id, 'full' ); ?>">
				<?php echo tattoopress_kses( $product->get_image( 'large' ) ); ?>
			</a>
		</span>
		<?php
		/**
		 * Placeholder
		 */
	} else {

		$html  = '<span class="woocommerce-product-gallery__image--placeholder">';
		$html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src() ), esc_html__( 'Awaiting product image', 'tattoopress' ) );
		$html .= '</span>';

		echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id );
	}

	echo '</div>';
}
add_action( 'woocommerce_before_single_product_summary', 'tattoopress_single_product_sticky_layout' );

add_action(
	'woocommerce_before_quantity_input_field',
	function() {
		echo '<span class="wt-quantity-plus"></span>';
	}
);

add_action(
	'woocommerce_after_quantity_input_field',
	function() {
		echo '<span class="wt-quantity-minus"></span>';
	}
);

/**
 * Filter WC tab
 *
 * Replace tabs by accordion
 */
function tattoopress_filter_wc_tabs( $markup, $tabs ) {
	if ( ! empty( $tabs ) ) :
		?>
		<?php ob_start(); ?>
		<div class="woocommerce-tabs">
			<div id="wvc-wc-accordion" class="wvc-accordion tabs-container">
				<?php
				$link_class = '';
				$i = 0;
				foreach ( $tabs as $key => $tab ) {
					if ( 2 === $i ) {
						$link_class = 'review-accordion-link';
					}
				?>
					<h2 class="wvc-accordion-tab"><a href="#" class="<?php echo esc_attr( $link_class ); ?>"><span class="wvc-at-title-container"><span class="wvc-at-title-text"><?php echo apply_filters( 'woocommerce_product_' . $key . '_tab_title', esc_html( $tab['title'] ), $key ); ?></span></span></a></h2>
					<div class="wvc-clearfix" ><div class="wbp_wrapper"><?php call_user_func( $tab['callback'], $key, $tab ); ?>
					</div><!--.wbp_wrapper--></div><!--.wvc-text-block-->
				<?php
				$i++;
				} ?>
			</div>
		</div>
		<?php
	endif;
	return ob_get_clean();
}
add_filter( 'tattoopress_wc_tabs', 'tattoopress_filter_wc_tabs', 10, 2 );

/**
 * Overwrite post types menu order
 *
 * @param array  $args
 * @param string $post_type
 * @return array $args
 */
function tattoopress_overwrite_post_type_menu_order( $args, $post_type ) {

	if ( 'video' === $post_type ) {

		$args['menu_position'] = 5.3;
	}

	if ( 'work' === $post_type ) {

		$args['menu_position'] = 5.4;
	}

	if ( 'wpm_playlist' === $post_type ) {

		$args['menu_position'] = 35;
	}

	if ( 'wvc_content_block' === $post_type ) {

		$args['menu_position'] = 40;
	}

	return $args;
}
add_filter( 'register_post_type_args', 'tattoopress_overwrite_post_type_menu_order', 99, 2 );

/**
 * Reorder admin menu
 */
function custom_menu_order( $menu_ord ) {
	if ( ! $menu_ord ) {
		return true;
	}

	return $menu_ord;
}

add_filter( 'custom_menu_order', 'custom_menu_order' );
add_filter( 'menu_order', 'custom_menu_order' );


/*
--------------------------------------------------------------------

	PLUGIN SETTINGS

----------------------------------------------------------------------
*/

/**
 * Set portfolio template folder
 */
function tattoopress_set_portfolio_template_url( $template_url ) {

	return tattoopress_get_template_url() . '/portfolio/';
}
add_filter( 'wolf_portfolio_template_url', 'tattoopress_set_portfolio_template_url' );

/**
 * Add custom fields in work meta
 */
add_action(
	'tattoopress_work_meta',
	function() {
		tattoopress_the_work_meta();
	},
	15
);

add_filter(
	'tattoopress_work_meta_separator',
	function() {
		return ' : ';
	}
);

/**
 * Set videos template folder
 */
function tattoopress_set_videos_template_url( $template_url ) {

	return tattoopress_get_template_url() . '/videos/';
}
add_filter( 'wolf_videos_template_url', 'tattoopress_set_videos_template_url' );

/**
 * Set video display
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_video_display( $string ) {

	return 'grid';
}
add_filter( 'tattoopress_mod_video_display', 'tattoopress_set_video_display', 44 );

/*
--------------------------------------------------------------------

	MODS

----------------------------------------------------------------------
*/

/**
 * Remove unused mods
 *
 * @param array $mods The default mods.
 * @return void
 */
function tattoopress_remove_mods( $mods ) {

	// Unset

	unset( $mods['layout']['options']['button_style'] );
	// unset( $mods['layout']['options']['site_layout'] );

	unset( $mods['fonts']['options']['body_font_size'] );

	unset( $mods['wolf_videos']['options']['video_display'] );

	unset( $mods['shop']['options']['product_display'] );

	unset( $mods['navigation']['options']['menu_skin'] );

	unset( $mods['header_settings']['options']['hero_scrolldown_arrow'] );

	unset( $mods['navigation']['options']['menu_layout']['choices']['offcanvas'] );

	// unset( $mods['navigation']['options']['menu_sticky_type']['choices']['soft'] );

	// unset( $mods['navigation']['options']['side_panel_position'] );

	// unset( $mods['blog']['options']['post_display'] );

	return $mods;
}
add_filter( 'tattoopress_customizer_mods', 'tattoopress_remove_mods', 20 );

/**
 * Spinners folder
 */
add_filter(
	'tattoopress_spinners_folder',
	function() {
		return tattoopress_get_template_dirname() . '/components/spinners/';
	}
);

/**
 * Add mods
 */
function tattoopress_add_mods( $mods ) {

	$color_scheme = tattoopress_get_color_scheme();

	$mods['layout']['options']['wrapper_width'] = array(
		'id'      => 'wrapper_width',
		'label'   => esc_html__( 'Wrapper Width', 'tattoopress' ),
		'type'    => 'select',
		'choices' => array(
			1400 => esc_html__( 'Large (1400px)', 'tattoopress' ),
			1140 => esc_html__( 'Small (1140px)', 'tattoopress' ),
		),
	);

	$mods['navigation']['options']['menu_hover_style'] = array(
		'id'        => 'menu_hover_style',
		'label'     => esc_html__( 'Menu Hover effect', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => apply_filters(
			'tattoopress_main_menu_hover_style_options',
			array(
				'none'        => esc_html__( 'None', 'tattoopress' ),
				'opacity'     => esc_html__( 'Opacity', 'tattoopress' ),
				'd-underline' => esc_html__( 'Underline', 'tattoopress' ),
			)
		),
		'transport' => 'postMessage',
	);

	$mods['navigation']['options']['sticky_menu_transparent'] = array(
		'label' => esc_html__( 'Transparent Sticky Menu', 'tattoopress' ),
		'id'    => 'sticky_menu_transparent',
		'type'  => 'checkbox',
	);

	$mods['loading'] = array(

		'id'      => 'loading',
		'title'   => esc_html__( 'Loading', 'tattoopress' ),
		'icon'    => 'update',
		'options' => array(

			array(
				'label'   => esc_html__( 'Loading Animation Type', 'tattoopress' ),
				'id'      => 'loading_animation_type',
				'type'    => 'select',
				'choices' => array(
					'none'             => esc_html__( 'None', 'tattoopress' ),
					'overlay'          => esc_html__( 'Simple Overlay', 'tattoopress' ),
					'logo'             => esc_html__( 'Overlay with Logo', 'tattoopress' ),
					'spinner-loader1'  => esc_html__( 'Rotating plane', 'tattoopress' ),
					'spinner-loader2'  => esc_html__( 'Double Pulse', 'tattoopress' ),
					'spinner-loader3'  => esc_html__( 'Wave', 'tattoopress' ),
					'spinner-loader4'  => esc_html__( 'Wandering cubes', 'tattoopress' ),
					'spinner-loader5'  => esc_html__( 'Pulse', 'tattoopress' ),
					'spinner-loader6'  => esc_html__( 'Chasing dots', 'tattoopress' ),
					'spinner-loader7'  => esc_html__( 'Three bounce', 'tattoopress' ),
					'spinner-loader8'  => esc_html__( 'Circle', 'tattoopress' ),
					'spinner-loader9'  => esc_html__( 'Cube grid', 'tattoopress' ),
					'spinner-loader10' => esc_html__( 'Classic Loader', 'tattoopress' ),
					'spinner-loader11' => esc_html__( 'Folding cube', 'tattoopress' ),
					'spinner-loader12' => esc_html__( 'Ball Pulse', 'tattoopress' ),
					'spinner-loader13' => esc_html__( 'Ball Grid Pulse', 'tattoopress' ),
					'spinner-loader15' => esc_html__( 'Ball Clip Rotate Pulse', 'tattoopress' ),
					'spinner-loader16' => esc_html__( 'Ball Clip Rotate Pulse Multiple', 'tattoopress' ),
					'spinner-loader17' => esc_html__( 'Ball Pulse Rise', 'tattoopress' ),
					'spinner-loader19' => esc_html__( 'Ball Zigzag', 'tattoopress' ),
					'spinner-loader20' => esc_html__( 'Ball Zigzag Deflect', 'tattoopress' ),
					'spinner-loader21' => esc_html__( 'Ball Triangle Path', 'tattoopress' ),
					'spinner-loader22' => esc_html__( 'Ball Scale', 'tattoopress' ),
					'spinner-loader23' => esc_html__( 'Ball Line Scale', 'tattoopress' ),
					'spinner-loader24' => esc_html__( 'Ball Line Scale Party', 'tattoopress' ),
					'spinner-loader25' => esc_html__( 'Ball Scale Multiple', 'tattoopress' ),
					'spinner-loader26' => esc_html__( 'Ball Pulse Sync', 'tattoopress' ),
					'spinner-loader27' => esc_html__( 'Ball Beat', 'tattoopress' ),
					'spinner-loader28' => esc_html__( 'Ball Scale Ripple Multiple', 'tattoopress' ),
					'spinner-loader29' => esc_html__( 'Ball Spin Fade Loader', 'tattoopress' ),
					'spinner-loader30' => esc_html__( 'Line Spin Fade Loader', 'tattoopress' ),
					'spinner-loader31' => esc_html__( 'Pacman', 'tattoopress' ),
					'spinner-loader32' => esc_html__( 'Ball Grid Beat ', 'tattoopress' ),
				),
			),

			'loading_logo' => array(
				'id'          => 'loading_logo',
				'description' => esc_html__( 'The loading animation will be disabled if you upload a loading logo.', 'tattoopress' ),
				'label'       => esc_html__( 'Optional Loading Logo', 'tattoopress' ),
				'type'        => 'image',
			),

			array(
				'label'   => esc_html__( 'Loading Logo Animation', 'tattoopress' ),
				'id'      => 'loading_logo_animation',
				'type'    => 'select',
				'choices' => array(
					'none'  => esc_html__( 'None', 'tattoopress' ),
					'pulse' => esc_html__( 'Pulse', 'tattoopress' ),
				),
			),
		),
	);

	$mods['blog']['options']['post_skin'] = array(
		'label'   => esc_html__( 'Color Tone in Loop', 'tattoopress' ),
		'id'      => 'post_skin',
		'type'    => 'select',
		'choices' => array(
			'dark'  => esc_html__( 'Dark', 'tattoopress' ),
			'light' => esc_html__( 'Light', 'tattoopress' ),
		),
	);

	$mods['blog']['options']['single_post_nav'] = array(
		'label'   => esc_html__( 'Prev/Next Post Pagination', 'tattoopress' ),
		'id'      => 'single_post_nav',
		'type'    => 'select',
		'choices' => array(
			'yes' => esc_html__( 'Yes', 'tattoopress' ),
			'no'  => esc_html__( 'No', 'tattoopress' ),
		),
	);

	$mods['blog']['options']['single_post_nav'] = array(
		'label'   => esc_html__( 'Prev/Next Post Pagination', 'tattoopress' ),
		'id'      => 'single_post_nav',
		'type'    => 'select',
		'choices' => array(
			'yes' => esc_html__( 'Yes', 'tattoopress' ),
			'no'  => esc_html__( 'No', 'tattoopress' ),
		),
	);

	$mods['blog']['options']['date_format'] = array(
		'label'   => esc_html__( 'Date Format', 'tattoopress' ),
		'id'      => 'date_format',
		'type'    => 'select',
		'choices' => array(
			''           => esc_html__( 'Default', 'tattoopress' ),
			'human_diff' => esc_html__( '"X Time ago"', 'tattoopress' ),
		// 'custom' => esc_html__( 'Calendar Syle', 'tattoopress' ),
		),
	);

	$mods['blog']['options']['post_hero_layout'] = array(
		'label'   => esc_html__( 'Single Post Header Layout', 'tattoopress' ),
		'id'      => 'post_hero_layout',
		'type'    => 'select',
		'choices' => array(
			''           => esc_html__( 'Default', 'tattoopress' ),
			'standard'   => esc_html__( 'Standard', 'tattoopress' ),
			'big'        => esc_html__( 'Big', 'tattoopress' ),
			'small'      => esc_html__( 'Small', 'tattoopress' ),
			'fullheight' => esc_html__( 'Full Height', 'tattoopress' ),
			'none'       => esc_html__( 'No header', 'tattoopress' ),
		),
	);

	$mods['blog']['options']['hide_single_post_featured_image'] = array(
		'label' => esc_html__( 'Hide Featured Image in Post', 'tattoopress' ),
		'id'    => 'hide_single_post_featured_image',
		'type'  => 'checkbox',
	);

	/*
	$mods['navigation']['options']['menu_sticky_type'] = array(
			'label'	=> esc_html__( 'Sticky Menu', 'tattoopress' ),
			'id'	=> 'menu_sticky_type',
			'type'	=> 'select',
			'choices' => array(
				'none' => esc_html__( 'Disabled', 'tattoopress' ),
				'hard' => esc_html__( 'Enabled', 'tattoopress' ),
			),
			'transport' => 'postMessage',
		);*/

	$mods['navigation']['options']['mega_menu_bg_img'] = array(
		'label' => esc_html__( 'Mega Menu Background', 'tattoopress' ),
		'id'    => 'mega_menu_bg_img',
		'type'  => 'image',
	);

	$mods['navigation']['options']['side_panel_bg_img'] = array(
		'label' => esc_html__( 'Side Panel Background', 'tattoopress' ),
		'id'    => 'side_panel_bg_img',
		'type'  => 'image',
	);

	$mods['navigation']['options']['overlay_menu_bg_img'] = array(
		'label' => esc_html__( 'Overlay Menu Background', 'tattoopress' ),
		'id'    => 'overlay_menu_bg_img',
		'type'  => 'image',
	);

	// $mods['navigation']['options']['mobile_menu_bg_img'] = array(
	// 'label' => esc_html__( 'Mobile Menu Background', 'tattoopress' ),
	// 'id'    => 'mobile_menu_bg_img',
	// 'type'  => 'image',
	// );

	// $mods['navigation']['options']['menu_offset'] = array(
	// 'id' => 'menu_offset',
	// 'label' => esc_html__( 'Menu Offset Top', 'tattoopress' ),
	// 'type' => 'text',
	// 'placeholder' => 400,
	// 'description' => sprintf( tattoopress_kses( __( 'Enter %s to display the navbar at the bottom of the screen', 'tattoopress' ) ), '100%' ),
	// );

	if ( isset( $mods['wolf_videos'] ) ) {

		$mods['wolf_videos']['options']['video_hero_layout'] = array(
			'label'   => esc_html__( 'Single Video Header Layout', 'tattoopress' ),
			'id'      => 'video_hero_layout',
			'type'    => 'select',
			'choices' => array(
				''           => esc_html__( 'Default', 'tattoopress' ),
				'standard'   => esc_html__( 'Standard', 'tattoopress' ),
				'big'        => esc_html__( 'Big', 'tattoopress' ),
				'small'      => esc_html__( 'Small', 'tattoopress' ),
				'fullheight' => esc_html__( 'Full Height', 'tattoopress' ),
				'none'       => esc_html__( 'No header', 'tattoopress' ),
			),
		);

		$mods['wolf_videos']['options']['video_category_filter'] = array(
			'id'    => 'video_category_filter',
			'label' => esc_html__( 'Category filter (not recommended with a lot of videos)', 'tattoopress' ),
			'type'  => 'checkbox',
		);

		$mods['wolf_videos']['options']['products_per_page'] = array(
			'label' => esc_html__( 'Videos per Page', 'tattoopress' ),
			'id'    => 'videos_per_page',
			'type'  => 'text',
		);

		$mods['wolf_videos']['options']['video_pagination'] = array(
			'id'      => 'video_pagination',
			'label'   => esc_html__( 'Video Archive Pagination', 'tattoopress' ),
			'type'    => 'select',
			'choices' => array(
				'standard_pagination' => esc_html__( 'Numeric Pagination', 'tattoopress' ),
				// 'ajax_pagination' => esc_html__( 'AJAX Pagination', 'tattoopress' ),
				'load_more'           => esc_html__( 'Load More Button', 'tattoopress' ),
				// 'infinitescroll' => esc_html__( 'Infinite Scroll', 'tattoopress' ),
			),
		);

		$mods['wolf_videos']['options']['video_display_elements'] = array(
			'id'          => 'video_display_elements',
			'label'       => esc_html__( 'Post meta to show in single video page', 'tattoopress' ),
			'type'        => 'group_checkbox',
			'choices'     => array(
				'show_date'       => esc_html__( 'Date', 'tattoopress' ),
				'show_author'     => esc_html__( 'Author', 'tattoopress' ),
				'show_category'   => esc_html__( 'Category', 'tattoopress' ),
				'show_tags'       => esc_html__( 'Tags', 'tattoopress' ),
				'show_extra_meta' => esc_html__( 'Extra Meta', 'tattoopress' ),
			),
			'description' => esc_html__( 'Note that some options may be ignored depending on the post display.', 'tattoopress' ),
		);

		if ( class_exists( 'Wolf_Custom_Post_Meta' ) ) {

			$mods['wolf_videos']['options'][] = array(
				'label'   => esc_html__( 'Enable Custom Post Meta', 'tattoopress' ),
				'id'      => 'video_enable_custom_post_meta',
				'type'    => 'group_checkbox',
				'choices' => array(
					'video_enable_views' => esc_html__( 'Views', 'tattoopress' ),
					'video_enable_likes' => esc_html__( 'Likes', 'tattoopress' ),
				),
			);
		}
	}

	if ( isset( $mods['portfolio'] ) ) {
		$mods['portfolio']['options']['work_skin'] = array(
			'label'   => esc_html__( 'Color Tone in Loop', 'tattoopress' ),
			'id'      => 'work_skin',
			'type'    => 'select',
			'choices' => array(
				'dark'  => esc_html__( 'Dark', 'tattoopress' ),
				'light' => esc_html__( 'Light', 'tattoopress' ),
			),
			// 'transport' => 'postMessage',
		);
		$mods['portfolio']['options']['work_hero_layout'] = array(
			'label'   => esc_html__( 'Single Work Header Layout', 'tattoopress' ),
			'id'      => 'work_hero_layout',
			'type'    => 'select',
			'choices' => array(
				''           => esc_html__( 'Default', 'tattoopress' ),
				'standard'   => esc_html__( 'Standard', 'tattoopress' ),
				'big'        => esc_html__( 'Big', 'tattoopress' ),
				'small'      => esc_html__( 'Small', 'tattoopress' ),
				'fullheight' => esc_html__( 'Full Height', 'tattoopress' ),
				'none'       => esc_html__( 'No header', 'tattoopress' ),
			),
			// 'transport' => 'postMessage',
		);
	}

	if ( isset( $mods['shop'] ) && class_exists( 'WooCommerce' ) ) {

		/*
		$mods['shop']['options']['product_skin'] = array(
			'label'	=> esc_html__( 'Color Tone in Loop', 'tattoopress' ),
			'id'	=> 'product_skin',
			'type'	=> 'select',
			'choices' => array(
				'dark' => esc_html__( 'Dark', 'tattoopress' ),
				'light' => esc_html__( 'Light', 'tattoopress' ),
			),
			//'transport' => 'postMessage',
		);*/

		$mods['shop']['options']['product_bg_color'] = array(
			'label'       => esc_html__( 'Product Background Color', 'tattoopress' ),
			'id'          => 'product_bg_color',
			'type'        => 'color',
			'description' => esc_html__( 'Background color of the post in the loop. You can use this option if your product image is a image in PNG format with a transparent background.', 'tattoopress' ),
			// 'transport' => 'postMessage',
		);

		$mods['shop']['options']['product_sticky'] = array(
			'label'       => esc_html__( 'Stacked Images with Sticky Product Details', 'tattoopress' ),
			'id'          => 'product_sticky',
			'type'        => 'checkbox',
			'description' => esc_html__( 'Not compatible with sidebar layouts.', 'tattoopress' ),
		);
	}

	if ( isset( $mods['wolf_albums'] ) ) {

		$mods['wolf_albums']['options']['gallery_hover_effect'] = array(
			'label'       => esc_html__( 'Album Hover Effect', 'tattoopress' ),
			'id'          => 'gallery_hover_effect',
			'type'        => 'select',
			'choices'     => array_flip( tattoopress_get_hover_effects() ),
			'description' => esc_html__( 'The default hover effect on archive pages.', 'tattoopress' ),
		);
	}

	return $mods;
}
add_filter( 'tattoopress_customizer_mods', 'tattoopress_add_mods', 40 );

/*
--------------------------------------------------------------------

	CUSTOM FUNCTIONS

----------------------------------------------------------------------
*/

/**
 * Custom calendar date format
 */
function tattoopress_custom_date( $date = '' ) {

	$date = ( $date ) ? $date : get_the_date( 'Y/m/d' );

	list( $year, $monthnbr, $day ) = explode( '/', $date );
	$search                        = array( '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12' );
	$replace                       = array( esc_html__( 'Jan', 'tattoopress' ), esc_html__( 'Feb', 'tattoopress' ), esc_html__( 'Mar', 'tattoopress' ), esc_html__( 'Apr', 'tattoopress' ), esc_html__( 'May', 'tattoopress' ), esc_html__( 'Jun', 'tattoopress' ), esc_html__( 'Jul', 'tattoopress' ), esc_html__( 'Aug', 'tattoopress' ), esc_html__( 'Sep', 'tattoopress' ), esc_html__( 'Oct', 'tattoopress' ), esc_html__( 'Nov', 'tattoopress' ), esc_html__( 'Dec', 'tattoopress' ) );
	$month                         = str_replace( $search, $replace, $monthnbr );

	$output = '<div class="date-format-custom wvc-bigtext"><span class="custom-date-day">' . $day . '</span><span class="custom-date-month">' . $month . '</span>';

	if ( 1 < absint( date( 'Y' ) ) - $year ) {
		$output .= '<span class="custom-date-year">' . $year . '</span>';
	}

	$output .= '</div>';

	return $output;
}

/*
--------------------------------------------------------------------

	DEFAULT MODS & SETTINGS

----------------------------------------------------------------------
*/

/**
 *  Set default icon font
 *
 * @param string $shape
 * @return string $shape
 */
function tattoopress_set_default_icon_font( $shape ) {
	return 'ionicons';
}
// add_filter( 'wvc_default_icon_font', 'tattoopress_set_default_icon_font', 40 );

/**
 *  Set default item overlay color
 *
 * @param string $color
 * @return string $color
 */
function tattoopress_set_default_item_overlay_color( $color ) {
	return 'white';
}
add_filter( 'wvc_default_item_overlay_color', 'tattoopress_set_default_item_overlay_color' );

/**
 *  Set default item overlay text color
 *
 * @param string $color
 * @return string $color
 */
function tattoopress_set_item_overlay_text_color( $color ) {
	return 'darkgrey';
}
add_filter( 'wvc_default_item_overlay_text_color', 'tattoopress_set_item_overlay_text_color', 10 );


/**
 *  Set default item overlay opacity
 *
 * @param int $color
 * @return int $color
 */
function tattoopress_set_item_overlay_opacity( $opacity ) {
	return 70;
}
add_filter( 'wvc_default_item_overlay_opacity', 'tattoopress_set_item_overlay_opacity' );

/**
 * Excerpt length hook
 * Set the number of character to display in the excerpt
 *
 * @param int $length
 * @return int
 */
function tattoopress_overwrite_excerpt_length( $length ) {

	return 23;
}
add_filter( 'tattoopress_excerpt_length', 'tattoopress_overwrite_excerpt_length' );

/**
 *  Set menu skin
 *
 * @param string $skin
 * @return string $skin
 */
function tattoopress_set_menu_skin( $skin ) {
	return 'dark';
}
add_filter( 'tattoopress_mod_menu_skin', 'tattoopress_set_menu_skin', 40 );

/**
 * Excerpt length hook
 * Set the number of character to display in the excerpt
 *
 * @param int $length
 * @return int
 */
function tattoopress_overwrite_sticky_menu_height( $length ) {

	return 66;
}
add_filter( 'tattoopress_sticky_menu_height', 'tattoopress_overwrite_sticky_menu_height' );

/**
 * Standard row width
 */
add_filter(
	'wvc_row_standard_width',
	function( $string ) {
		return '1400px';
	},
	40
);

/**
 * Small width
 */
add_filter(
	'wvc_row_small_width',
	function( $string ) {

		$string = '960px';

		if ( 1140 === tattoopress_get_inherit_mod( 'wrapper_width' ) ) {
			$string = '750px';
		}

		return $string;
	},
	40
);

/**
 *  Set default row skin
 *
 * @param string $font_color
 * @return string $font_color
 */
function tattoopress_set_default_wvc_row_font_color( $font_color ) {

	// check main skin?

	return 'light';
}
add_filter( 'wvc_default_row_font_color', 'tattoopress_set_default_wvc_row_font_color', 40 );

/**
 * Load more pagination hash change
 */
add_filter(
	'tattoopress_loadmore_pagination_hashchange',
	function( $size ) {
		return false;
	},
	40
);

add_filter(
	'tattoopress_load_more_posts_text',
	function( $text ) {
		return esc_html__( 'load More', 'tattoopress' );
	},
	40
);

/**
 *  Set embed video title
 *
 * @param string $title
 * @return string $title
 */
function wvc_set_embed_video_title( $title ) {

	return esc_html__( '&mdash; %s', 'tattoopress' );
}
add_filter( 'wvc_embed_video_title', 'wvc_set_embed_video_title', 40 );

/**
 *  Set embed video title
 *
 * @param string $title
 * @return string $title
 */
function tattoopress_set_default_video_opener_button( $title ) {

	return '<span class="video-opener" data-aos="fade" data-aos-once="true"></span>';
}
add_filter( 'wvc_default_video_opener_button', 'tattoopress_set_default_video_opener_button', 40 );

/**
 *  Set default pie chart line width
 *
 * @param string $width
 * @return string $width
 */
function wvc_set_default_pie_chart_line_width( $width ) {
	return 5;
}
add_filter( 'wvc_default_pie_chart_line_width', 'wvc_set_default_pie_chart_line_width', 40 );



/**
 *  Set default button shape
 *
 * @param string $shape
 * @return string $shape
 */
function tattoopress_set_default_wvc_button_shape( $shape ) {
	return 'boxed';
}
add_filter( 'wvc_default_button_shape', 'tattoopress_set_default_wvc_button_shape', 40 );

/**
 *  Set default button shape
 *
 * @param string $shape
 * @return string $shape
 */
function tattoopress_set_default_theme_button_shape( $shape ) {
	return 'square';
}
add_filter( 'tattoopress_mod_button_style', 'tattoopress_set_default_theme_button_shape', 40 );

/**
 * Default font weight
 */
add_filter(
	'wvc_button_default_font_weight',
	function( $font_weight ) {
		return 700;
	}
);

/**
 *  Set default team member title font size
 *
 * @param string $font_size
 * @return string $font_size
 */
function wvc_set_default_team_member_font_size( $font_size ) {
	return 18;
}
add_filter( 'wvc_default_team_member_title_font_size', 'wvc_set_default_team_member_font_size', 40 );
add_filter( 'wvc_default_single_image_title_font_size', 'wvc_set_default_team_member_font_size', 40 );

/**
 *  Set default team member text align
 *
 * @param string $string
 * @return string $string
 */
function wvc_set_default_team_member_text_alignement( $string ) {
	return 'center';
}
add_filter( 'wvc_default_team_member_text_alignement', 'wvc_set_default_team_member_text_alignement', 40 );

/**
 *  Set default team member v align
 *
 * @param string $string
 * @return string $string
 */
function wvc_set_default_team_member_text_vertical_alignement( $string ) {

	return 'bottom';
}
add_filter( 'wvc_default_team_member_text_vertical_alignement', 'wvc_set_default_team_member_text_vertical_alignement', 40 );

/**
 *  Set default heading layout
 *
 * @param string $layout
 * @return string $layout
 */
function wvc_set_default_team_member_layout( $layout ) {
	return 'standard';
}
add_filter( 'wvc_default_team_member_layout', 'wvc_set_default_team_member_layout', 40 );

/**
 *  Set default heading font size
 *
 * @param int $font_size
 * @return int $font_size
 */
function wvc_set_default_custom_heading_font_size( $font_size ) {
	return 32;
}
add_filter( 'wvc_default_custom_heading_font_size', 'wvc_set_default_custom_heading_font_size', 40 );
add_filter( 'wvc_default_advanced_slide_title_font_size', 'wvc_set_default_custom_heading_font_size', 40 );

/**
 *  Set default heading font family
 *
 * @param string $font_family
 * @return string $font_family
 */
function tattoopress_set_default_custom_heading_font_family( $font_family ) {
	return 'Oswald';
}
add_filter( 'wvc_default_bigtext_font_family', 'tattoopress_set_default_custom_heading_font_family', 40 );
// add_filter( 'wvc_default_advanced_slide_title_font_family', 'tattoopress_set_default_custom_heading_font_family', 40 );
// add_filter( 'wvc_default_custom_heading_font_family', 'tattoopress_set_default_custom_heading_font_family', 40 );
// add_filter( 'wvc_default_cta_font_family', 'tattoopress_set_default_custom_heading_font_family', 40 );

/**
 *  Set default heading font weight
 *
 * @param string $font_weight
 * @return string $font_weight
 */
function tattoopress_set_default_custom_heading_font_weight( $font_weight ) {
	return '';
}
add_filter( 'wvc_default_advanced_slide_title_font_weight', 'tattoopress_set_default_custom_heading_font_weight', 40 );
add_filter( 'wvc_default_custom_heading_font_weight', 'tattoopress_set_default_custom_heading_font_weight', 40 );
add_filter( 'wvc_default_bigtext_font_weight', 'tattoopress_set_default_custom_heading_font_weight', 40 );
add_filter( 'wvc_default_cta_font_weight', 'tattoopress_set_default_custom_heading_font_weight', 40 );
add_filter( 'wvc_default_pie_font_weight', 'tattoopress_set_default_custom_heading_font_weight', 40 );

/**
 *  Set default heading font size
 *
 * @param string $font_size
 * @return string $font_size
 */
function wvc_set_default_cta_font_size( $font_size ) {
	return 22;
}
add_filter( 'wvc_default_cta_font_size', 'wvc_set_default_cta_font_size', 40 );

/**
 * Post Slider color tone
 */
function tattoopress_add_post_slider_color_block() {
	?>
	<div class="wvc-big-slide-color-block" style="background-color:<?php echo wvc_color_brightness( wvc_get_image_dominant_color( get_post_thumbnail_id() ), 10 ); ?>"></div>
	<?php
}
add_action( 'wvc_post_big_slide_start', 'tattoopress_add_post_slider_color_block' );

/*
--------------------------------------------------------------------

	BUTTONS

----------------------------------------------------------------------
*/

/**
 * Custom button types
 */
function tattoopress_custom_button_types() {
	return array(
		esc_html__( 'Default', 'tattoopress' )            => 'default',
		esc_html__( 'Special Accent', 'tattoopress' )     => 'tattoopress-button-special-accent',
		esc_html__( 'Solid Accent', 'tattoopress' )       => 'tattoopress-button-solid-accent',
		esc_html__( 'Outline Accent', 'tattoopress' )     => 'tattoopress-button-outline-accent',
		esc_html__( 'Simple Text Accent', 'tattoopress' ) => 'tattoopress-button-text-accent',
		esc_html__( 'Special', 'tattoopress' )            => 'tattoopress-button-special',
		esc_html__( 'Solid', 'tattoopress' )              => 'tattoopress-button-solid',
		esc_html__( 'Outline', 'tattoopress' )            => 'tattoopress-button-outline',
		esc_html__( 'Simple Text', 'tattoopress' )        => 'tattoopress-button-text',
		// esc_html__( 'Simple Text Alt', 'tattoopress' ) => 'tattoopress-button-simple-alt',
	);
}

/**
 * Primary Special buttons class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_primary_special_button_class( $class ) {

	$tattoopress_button_class = 'tattoopress-button-solid';

	$class = $tattoopress_button_class . ' wvc-button wvc-button-size-sm';

	return $class;
}
add_filter( 'wvc_last_posts_big_slide_button_class', 'tattoopress_set_primary_special_button_class' );

/**
 * Primary Special buttons class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_primary_special_button_outline( $class ) {

	$tattoopress_button_class = 'tattoopress-button-text';

	$class = $tattoopress_button_class . ' wvc-button wvc-button-size-sm';

	return $class;
}
add_filter( 'tattoopress_loadmore_button_class', 'tattoopress_set_primary_special_button_outline' );

/**
 * Primary Outline buttons class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_primary_button_class( $class ) {

	$tattoopress_button_class = 'tattoopress-button-solid';

	$class = $tattoopress_button_class . ' wvc-button wvc-button-size-sm';

	return $class;
}
add_filter( 'tattoopress_404_button_class', 'tattoopress_set_primary_button_class' );

/**
 * Event ticket button class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_single_add_to_cart_button_class( $class ) {

	$class = 'single_add_to_cart_button button tattoopress-button-solid-accent';

	return $class;
}
add_filter( 'tattoopress_single_add_to_cart_button_class', 'tattoopress_set_single_add_to_cart_button_class', 40 );

/**
 * Text buttons class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_more_link_button_class( $class ) {

	$tattoopress_button_class = 'tattoopress-button-text';

	$class = $tattoopress_button_class . ' wvc-button wvc-button-size-sm';

	return $class;
}
add_filter( 'tattoopress_more_link_button_class', 'tattoopress_set_more_link_button_class' );
add_filter( 'wvc_showcase_vertical_carousel_button_class', 'tattoopress_set_more_link_button_class' );

/**
 * Author box buttons class
 *
 * @param string $string
 * @return string
 */
function tattoopress_set_author_box_button_class( $class ) {

	$class = ' wvc-button wvc-button-size-xs tattoopress-button-text';

	return $class;
}
add_filter( 'tattoopress_author_page_link_button_class', 'tattoopress_set_author_box_button_class' );

/**
 * Add button dependencies
 */
function tattoopress_add_button_dependency_params() {

	if ( ! class_exists( 'WPBMap' ) || ! class_exists( 'Wolf_Visual_Composer' ) || ! defined( 'WVC_OK' ) || ! WVC_OK ) {
		return;
	}

	$param               = WPBMap::getParam( 'vc_button', 'color' );
	$param['dependency'] = array(
		'element' => 'button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_button', $param );

	$param               = WPBMap::getParam( 'vc_button', 'shape' );
	$param['dependency'] = array(
		'element' => 'button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_button', $param );

	$param               = WPBMap::getParam( 'vc_button', 'hover_effect' );
	$param['dependency'] = array(
		'element' => 'button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_button', $param );

	$param               = WPBMap::getParam( 'wvc_banner', 'btn_color' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_banner', $param );

	$param               = WPBMap::getParam( 'wvc_banner', 'btn_shape' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_banner', $param );

	$param               = WPBMap::getParam( 'wvc_banner', 'btn_hover_effect' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_banner', $param );

	$param               = WPBMap::getParam( 'vc_cta', 'btn_color' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_cta', $param );

	$param               = WPBMap::getParam( 'vc_cta', 'btn_shape' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_cta', $param );

	$param               = WPBMap::getParam( 'vc_cta', 'btn_hover_effect' );
	$param['dependency'] = array(
		'element' => 'btn_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'vc_cta', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b1_color' );
	$param['dependency'] = array(
		'element' => 'b1_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b1_shape' );
	$param['dependency'] = array(
		'element' => 'b1_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b1_hover_effect' );
	$param['dependency'] = array(
		'element' => 'b1_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b2_color' );
	$param['dependency'] = array(
		'element' => 'b2_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b2_shape' );
	$param['dependency'] = array(
		'element' => 'b2_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );

	$param               = WPBMap::getParam( 'wvc_advanced_slide', 'b2_hover_effect' );
	$param['dependency'] = array(
		'element' => 'b2_button_type',
		'value'   => 'default',
	);
	vc_update_shortcode_param( 'wvc_advanced_slide', $param );
}
add_action( 'init', 'tattoopress_add_button_dependency_params', 15 );

/**
 *  Add background loader effect
 *
 * @param string $effects
 * @return string $effects
 */
function tattoopress_add_wvc_custom_background_effect( $effects ) {

	if ( function_exists( 'vc_add_param' ) ) {

		vc_add_param(
			'vc_row',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Filmgrain Overlay', 'tattoopress' ),
				'param_name' => 'add_filmgrain',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_row',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Grunge Overlay', 'tattoopress' ),
				'param_name' => 'add_grunge',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Filmgrain Overlay', 'tattoopress' ),
				'param_name' => 'add_filmgrain',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Grunge Overlay', 'tattoopress' ),
				'param_name' => 'add_grunge',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'wvc_advanced_slide',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Filmgrain Overlay', 'tattoopress' ),
				'param_name' => 'add_filmgrain',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'wvc_advanced_slide',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Grunge Overlay', 'tattoopress' ),
				'param_name' => 'add_grunge',
				// 'group' => esc_html__( 'Background', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Filmgrain Overlay', 'tattoopress' ),
				'param_name' => 'add_filmgrain',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Grunge Overlay', 'tattoopress' ),
				'param_name' => 'add_grunge',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column_inner',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Filmgrain Overlay', 'tattoopress' ),
				'param_name' => 'add_filmgrain',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'vc_column_inner',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Add Grunge Overlay', 'tattoopress' ),
				'param_name' => 'add_grunge',
				'group'      => esc_html__( 'Style', 'tattoopress' ),
			)
		);

		vc_add_param(
			'rev_slider_vc',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Preloader Background', 'tattoopress' ),
				'param_name' => 'preloader_bg',
			)
		);
	}
}
add_action( 'init', 'tattoopress_add_wvc_custom_background_effect' );

/**
 *  Add work gallery
 *
 * @param string $effects
 * @return string $effects
 */
function tattoopress_add_work_gallery_param( $effects ) {

	if ( function_exists( 'vc_add_param' ) ) {
		vc_add_param(
			'wvc_work_index',
			array(
				'type'       => 'checkbox',
				'heading'    => esc_html__( 'Use as gallery', 'tattoopress' ),
				'param_name' => 'work_is_gallery',
				'desc'       => esc_html__( 'The first gallery in the posts will open directly in a lightbox.', 'tattoopress' ),
			)
		);
	}
}
add_action( 'init', 'tattoopress_add_work_gallery_param' );

/**
 * Get hover effects
 */
function tattoopress_get_hover_effects() {
	return array(
		esc_html__( 'None', 'tattoopress' )              => 'none',
		esc_html__( 'Simple', 'tattoopress' )            => 'simple',
		esc_html__( 'Slide Up', 'tattoopress' )          => 'slide-up',
		esc_html__( 'Grunge', 'tattoopress' )            => 'grunge',
		esc_html__( 'Old Version Style', 'tattoopress' ) => 'old',
	);
}

/**
 * Add hover effects
 */
function tattoopress_add_hover_effects() {
	if ( function_exists( 'vc_add_params' ) ) {

		vc_add_params(
			'wvc_gallery_index',
			array(
				array(
					'heading'     => esc_html__( 'Hover Effect', 'tattoopress' ),
					'param_name'  => 'gallery_hover_effect',
					'type'        => 'dropdown',
					'value'       => tattoopress_get_hover_effects(),
					'description' => esc_html__( 'Settings above may be overwritten.', 'tattoopress' ),
					'dependency'  => array(
						'element' => 'gallery_display',
						'value'   => array( 'grid', 'metro', 'masonry' ),
					),
					'std'         => tattoopress_get_theme_mod( 'gallery_hover_effect' ),
					'admin_label' => true,
				),
			)
		);
	}
}
add_action( 'init', 'tattoopress_add_hover_effects' );

/**
 * Gallery hover effect
 */
add_filter(
	'gallery_default_hover_effect',
	function() {
		tattoopress_get_theme_mod( 'gallery_hover_effect', 'none' );
	}
);

/**
 * Albums default align
 */
add_filter(
	'gallery_caption_align',
	function() {
		return 'center';
	}
);

/**
 * Albums default align
 */
add_filter(
	'gallery_caption_valign',
	function() {
		return 'bottom';
	}
);

/**
 * Rewrite gallery type taxonomy slug
 */
function tattoopress_change_gallery_type_taxonomies_slug( $args, $taxonomy ) {
	if ( 'gallery_type' === $taxonomy ) {
		$args['rewrite']['slug'] = 'artist-galleries';
	}
	return $args;
}
add_filter( 'register_taxonomy_args', 'tattoopress_change_gallery_type_taxonomies_slug', 10, 2 );

/**
 * Rewrite gallery type taxonomy slug
 */
function tattoopress_gallery_type_url_rewrite() {
	add_rewrite_rule( '^artist-galleries/([^/]*)$', 'index.php?gallery_type=$matches[1]', 'top' );
	flush_rewrite_rules();
}
add_action( 'admin_init', 'tattoopress_gallery_type_url_rewrite' );

/**
 * Filter button attribute
 *
 * @param array $atts
 * @return array $atts
 */
function woltheme_filter_button_atts( $atts ) {

	// button
	if ( isset( $atts['button_type'] ) && 'default' !== $atts['button_type'] ) {
		$atts['shape']        = '';
		$atts['color']        = '';
		$atts['hover_effect'] = '';
		$atts['el_class']    .= ' ' . $atts['button_type'];
	}

	return $atts;
}
add_filter( 'wvc_button_atts', 'woltheme_filter_button_atts' );

add_filter(
	'wvc_revslider_container_class',
	function( $class, $atts ) {

		if ( isset( $atts['preloader_bg'] ) && 'true' === $atts['preloader_bg'] ) {
			$class .= ' wvc-preloader-bg';
		}

		return $class;

	},
	10,
	2
);

/**
 * Filter CTA button attribute
 *
 * @param array $atts the shortcode atts we get
 * @param array $btn_params the button attribute to filter
 * @return array $btn_params
 */
function woltheme_filter_banner_button_atts( $btn_params, $atts ) {

	// button
	if ( isset( $atts['btn_button_type'] ) && 'default' !== $atts['btn_button_type'] ) {
		$btn_params['shape']        = '';
		$btn_params['color']        = '';
		$btn_params['hover_effect'] = '';
		$btn_params['el_class']    .= ' ' . $atts['btn_button_type'];
	}

	return $btn_params;
}
add_filter( 'wvc_banner_button_atts', 'woltheme_filter_banner_button_atts', 10, 2 );

/**
 * Filter CTA button attribute
 *
 * @param array $atts the shortcode atts we get
 * @param array $btn_params the button attribute to filter
 * @return array $btn_params
 */
function woltheme_filter_cta_button_atts( $btn_params, $atts ) {

	// button
	if ( isset( $atts['btn_button_type'] ) && 'default' !== $atts['btn_button_type'] ) {
		$btn_params['shape']        = '';
		$btn_params['color']        = '';
		$btn_params['hover_effect'] = '';
		$btn_params['el_class']    .= ' ' . $atts['btn_button_type'];
	}

	return $btn_params;
}
add_filter( 'wvc_cta_button_atts', 'woltheme_filter_cta_button_atts', 10, 2 );

/**
 * Filter advanced slider button 1 attribute
 *
 * @param array $atts the shortcode atts we get
 * @param array $b1_params the button attribute to filter
 * @return array $b1_params
 */
function woltheme_filter_b1_button_atts( $b1_params, $atts ) {

	// button
	if ( isset( $atts['b1_button_type'] ) && 'default' !== $atts['b1_button_type'] ) {
		$b1_params['shape']        = '';
		$b1_params['color']        = '';
		$b1_params['hover_effect'] = '';
		$b1_params['el_class']    .= ' ' . $atts['b1_button_type'];
	}

	return $b1_params;
}
add_filter( 'wvc_advanced_slider_b1_button_atts', 'woltheme_filter_b1_button_atts', 10, 2 );

/**
 * Filter advanced slider button 1 attribute
 *
 * @param array $atts the shortcode atts we get
 * @param array $b2_params the button attribute to filter
 * @return array $b2_params
 */
function woltheme_filter_b2_button_atts( $b2_params, $atts ) {

	// button
	if ( isset( $atts['b2_button_type'] ) && 'default' !== $atts['b2_button_type'] ) {
		$b2_params['shape']        = '';
		$b2_params['color']        = '';
		$b2_params['hover_effect'] = '';
		$b2_params['el_class']    .= ' ' . $atts['b2_button_type'];
	}

	return $b2_params;
}
add_filter( 'wvc_advanced_slider_b2_button_atts', 'woltheme_filter_b2_button_atts', 10, 2 );

/**
 * Add theme button option to Button element
 */
function tattoopress_add_theme_buttons() {

	if ( function_exists( 'vc_add_params' ) ) {
		vc_add_params(
			'vc_button',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 1000,
				),
			)
		);

		vc_add_params(
			'wvc_banner',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'btn_button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 1000,
					'group'      => esc_html__( 'Button', 'tattoopress' ),
					'dependency' => array(
						'element' => 'add_button',
						'value'   => 'true',
					),
				),
			)
		);

		vc_add_params(
			'vc_cta',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'btn_button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 10,
					'group'      => esc_html__( 'Button', 'tattoopress' ),
				),
			)
		);

		vc_add_params(
			'wvc_audio_button',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'btn_button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 10,
					// 'group' => esc_html__( 'Button', 'tattoopress' ),
				),
			)
		);

		vc_add_params(
			'wvc_advanced_slide',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'b1_button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 10,
					'group'      => esc_html__( 'Button 1', 'tattoopress' ),
					'dependency' => array(
						'element' => 'add_button_1',
						'value'   => array( 'true' ),
					),
				),
			)
		);

		vc_add_params(
			'wvc_advanced_slide',
			array(
				array(
					'heading'    => esc_html__( 'Button Type', 'tattoopress' ),
					'param_name' => 'b2_button_type',
					'type'       => 'dropdown',
					'value'      => tattoopress_custom_button_types(),
					'weight'     => 10,
					'group'      => esc_html__( 'Button 2', 'tattoopress' ),
					'dependency' => array(
						'element' => 'add_button_2',
						'value'   => array( 'true' ),
					),
				),
			)
		);

		/*
		vc_add_params(
			'wvc_product_index',
			array(
				array(
					'heading' => esc_html__( 'Layout', 'tattoopress' ),
					'param_name' => 'product_layout',
					'type' => 'dropdown',
					'value' => array(
						esc_html__( 'Standard', 'tattoopress' ) => 'standard',
						//esc_html__( 'Overlay', 'tattoopress' ) => 'overlay',
						esc_html__( 'Label', 'tattoopress' ) => 'label',
					),
					'weight' => 10,
				),
			)
		);*/

		vc_add_params(
			'wvc_work_index',
			array(
				array(
					'heading'    => esc_html__( 'Filter Alignement', 'tattoopress' ),
					'param_name' => 'work_category_filter_text_alignment',
					'type'       => 'dropdown',
					'value'      => array(
						esc_html__( 'Centered', 'tattoopress' ) => 'center',
						esc_html__( 'Spread', 'tattoopress' ) => 'spread',
					),
					'dependency' => array(
						'element' => 'work_category_filter',
						'value'   => array( 'true' ),
					),
				),
			)
		);

		vc_add_params(
			'wvc_video_index',
			array(
				array(
					'heading'    => esc_html__( 'Filter Alignement', 'tattoopress' ),
					'param_name' => 'video_category_filter_text_alignment',
					'type'       => 'dropdown',
					'value'      => array(
						esc_html__( 'Centered', 'tattoopress' ) => 'center',
						esc_html__( 'Spread', 'tattoopress' ) => 'spread',
					),
					'dependency' => array(
						'element' => 'video_category_filter',
						'value'   => array( 'true' ),
					),
				),
			)
		);
	}
}
add_action( 'init', 'tattoopress_add_theme_buttons' );

function tattoopress_add_menu_cta_content_type_options( $array ) {

	$array['custom'] = esc_html__( 'Mixed (cart, socials and search icon)', 'tattoopress' );

	return $array;
}
add_filter( 'tattoopress_menu_cta_content_type_options', 'tattoopress_add_menu_cta_content_type_options' );

/*
--------------------------------------------------------------------

	CUSTOM WVC ELEMENT

----------------------------------------------------------------------
*/


/**
 * Output old style CTA
 */
function tattoopress_output_mixed_cta_content() {
	?>
	<div class="cart-container cta-item">
		<?php
			/**
			 * Cart icon
			 */
			tattoopress_cart_menu_item();

			/**
			 * Cart panel
			 */
			echo tattoopress_cart_panel();
		?>
	</div><!-- .cart-container -->
	<div class="search-container cta-item">
		<?php
			/**
			 * Search
			 */
			echo tattoopress_search_menu_item();
		?>
	</div><!-- .search-container -->
	<?php
	if ( function_exists( 'wvc_socials' ) ) {
		echo wvc_socials( array( 'services' => tattoopress_get_inherit_mod( 'menu_socials', 'facebook,twitter,instagram' ) ) );
	}
	?>
	<?php
}
add_action( 'tattoopress_custom_menu_cta_content', 'tattoopress_output_mixed_cta_content' );


if ( ! function_exists( 'tattoopress_gallery_meta' ) ) {
	/**
	 * Gallery meta
	 */
	function tattoopress_gallery_meta() {

		?>
		<a href="#" data-gallery-params="<?php echo esc_js( wp_json_encode( tattoopress_get_gallery_params() ) ); ?>" class="gallery-quickview" title="<?php esc_html_e( 'Quickview', 'tattoopress' ); ?>">
		<?php
			/**
			 * Photo count
			 */
			printf( esc_html__( '%d photos', 'tattoopress' ), tattoopress_get_first_gallery_image_count() );
		?>
		</a>
		<?php
		if ( get_the_term_list( get_the_ID(), 'gallery_type', '', ' / ', '' ) ) {
			?>
			<span class="gallery-meta-separator">&mdash;</span>
			<?php
				/**
				 * Gallery taxonomy
				 */
				echo get_the_term_list( get_the_ID(), 'gallery_type', '', ' / ', '' );

		}
	}
}

function tattoopress_remove_gallery_post_type_comment( $args, $post_type ) {
	if ( 'gallery' === $post_type ) {
		$args['supports'] = array( 'title', 'editor', 'thumbnail' );
	}

	return $args;
}
add_filter( 'register_post_type_args', 'tattoopress_remove_gallery_post_type_comment', 10, 2 );


/*
----------------------------------------------------------------------------------

	ADMIN TAB

--------------------------------------------------------------------------------------
*/

/**
 * Theme license tab
 */
function tattoopress_output_v3_tab() {
	?>
	<a href="#tattoopress-v3" class="nav-tab"><?php esc_html_e( 'What\'s New', 'tattoopress' ); ?></a>
	<?php
}
add_action( 'tattoopress_before_about_tabs', 'tattoopress_output_v3_tab' );

/**
 * Theme license tab
 */
function tattoopress_output_v3_content() {
	?>
	<div id="tattoopress-v3" class="wvc-options-panel">
		<div id="tattoopress-img">
			<img src="<?php echo esc_url( get_template_directory_uri() . '/config/tattoopress-v3.png' ); ?>" alt="<?php esc_html_e( 'TatooPress v3', 'tattoopress' ); ?>">
		</div>
		<div id="dv3-content">
			<h3><?php esc_html_e( 'Welcome to TatooPress version 3 (formerly Tattoo Pro)', 'tattoopress' ); ?></h3>

			<p class="big-tagline"><?php esc_html_e( 'We took the best from our most recent themes and put it back to TatooPress to make it even better. We also added new exlusive features.', 'tattoopress' ); ?></p>
			<?php
				/**
				 * Update instructions from TatooPress updater plugin
				 */
			if ( get_option( 'wolf_theme_options_tattoopress' ) && ! get_option( 'tattoopress_v2_fully_updated' ) ) {
				if ( function_exists( 'tattoopress_v3_update_instructions' ) ) {
					tattoopress_v3_update_instructions();
				}
			}
			?>
			<h4><?php esc_html_e( 'What\'s New', 'tattoopress' ); ?></h4>
			<ul class="bullet-list">
				<li><?php esc_html_e( 'The backend has been completely rebuilt.', 'tattoopress' ); ?></li>
				<li><?php esc_html_e( 'The theme design has been fully repolished and modernized.', 'tattoopress' ); ?></li>
				<li><?php esc_html_e( 'Some deprecated design featured have been removed.', 'tattoopress' ); ?></li>
				<li><?php esc_html_e( 'The theme options have been moved to the customizer.', 'tattoopress' ); ?></li>
				<li><?php esc_html_e( 'Many design options have been added.', 'tattoopress' ); ?></li>
				<li><?php esc_html_e( 'Many page options have been added below your page editor.', 'tattoopress' ); ?></li>
				<li>
				<?php
				printf(
					tattoopress_kses( __( 'Tons of features and page builder elements have been added via our <a href="%1$s" target="_blank">%2$s</a>.', 'tattoopress' ) ),
					'https://wolfthemes.ticksy.com/article/14866/',
					'Wolf WPBakery Page Builder Extension'
				);
				?>
				 </li>
				<li><?php esc_html_e( 'We have added many new homepages, inner pages and post type layouts to the demo content.', 'tattoopress' ); ?></li>
				<li>
				<?php
				printf(
					tattoopress_kses( __( 'The Wolf Slider plugin has been deprecated in favor of the page builder slider elements and the <a href="%s" target="_blank">content block system</a>.', 'tattoopress' ) ),
					'https://wolfthemes.ticksy.com/article/12792'
				);
				?>
				</li>
			</ul>
		</div>
		<div class="clear"></div>
	</div><!-- #tattoopress-v3 -->
	<?php
}
add_action( 'tattoopress_before_about_tabs_content', 'tattoopress_output_v3_content' );
