Current File : /home/kelaby89/muzza.fit/wp-content/themes/deadlift/inc/theme-functions.php |
<?php
/**
* Deadlift frontend theme specific functions
*
* @package WordPress
* @subpackage Deadlift
* @version 1.8.2
*/
defined( 'ABSPATH' ) || exit;
/**
* Add custom font
*/
function deadlift_add_google_font( $google_fonts ) {
$default_fonts = array(
'Muli' => 'Muli400,500,700',
'Raleway' => 'Raleway:400,500,700',
'Rubik' => 'Rubik:400,500,700',
'Oswald' => 'Oswald:400,500,600,700,800',
'Playfair Display' => 'Playfair+Display:400,700',
);
foreach ( $default_fonts as $key => $value ) {
if ( ! isset( $google_fonts[ $key ] ) ) {
$google_fonts[ $key ] = $value;
}
}
return $google_fonts;
}
add_filter( 'deadlift_google_fonts', 'deadlift_add_google_font' );
/**
* Overwrite standard post entry slider image size
*/
function deadlift_overwrite_entry_slider_img_size( $size ) {
add_filter(
'deadlift_entry_slider_image_size',
function() {
return '847x508';
}
);
}
add_action( 'after_setup_theme', 'deadlift_overwrite_entry_slider_img_size', 50 );
add_filter(
'wvc_recipe_image_size',
function() {
return 'deadlift-slide';
}
);
add_filter(
'deadlift_view_more_works_text',
function() {
return esc_html__( 'View more programs', 'deadlift' );
}
);
/**
* Post excerpt read more
*/
function deadlift_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( 'deadlift_more_link_button_class', 'more-link' ) ); ?>"><?php esc_html_e( 'Read more', 'deadlift' ); ?></a></p>
<?php
}
add_action( 'deadlift_post_grid_classic_excerpt', 'deadlift_output_post_grid_classic_excerpt_read_more', 44 );
add_action( 'deadlift_post_masonry_excerpt', 'deadlift_output_post_grid_classic_excerpt_read_more', 44 );
/**
* Add custom elements to theme
*
* @param array $elements
* @return array $elements
*/
function deadlift_add_available_wvc_elements( $elements ) {
// $elements[] = 'text-slider';
if ( class_exists( 'WooCommerce' ) ) {
$elements[] = 'wc-searchform';
$elements[] = 'login-form';
$elements[] = 'product-presentation';
}
if ( class_exists( 'Wolf_Videos' ) ) {
$elements[] = 'video-switcher';
}
if ( class_exists( 'Mp_Time_Table' ) ) {
$elements[] = 'mp-timetable';
}
$elements[] = 'bmi-calculator';
$elements[] = 'recipe';
$elements[] = 'meal';
$elements[] = 'meal-item';
$elements[] = 'workout-program-exercice';
$elements[] = 'workout-program';
return $elements;
}
add_filter( 'wvc_element_list', 'deadlift_add_available_wvc_elements', 44 );
/**
* Disable default loading and transition animation
*
* @param bool $bool enable/disable default loading animation.
* @return bool
*/
function deadlift_reset_loading_anim( $bool ) {
return false;
}
add_filter( 'deadlift_display_loading_logo', 'deadlift_reset_loading_anim' );
add_filter( 'deadlift_display_loading_overlay', 'deadlift_reset_loading_anim' );
add_filter( 'deadlift_default_page_loading_animation', 'deadlift_reset_loading_anim' );
add_filter( 'deadlift_default_page_transition_animation', 'deadlift_reset_loading_anim' );
/**
* Loading title markup
*/
function deadlift_loading_animation_markup() {
if ( 'none' !== deadlift_get_inherit_mod( 'loading_animation_type', 'overlay' ) ) :
?>
<div class="deadlift-loader-overlay">
<div id="deadlift-loader">
<?php if ( 'deadlift' === deadlift_get_inherit_mod( 'loading_animation_type', 'overlay' ) ) : ?>
<div id="deadlift-percent">0%</div>
<?php endif; ?>
</div><!-- .deadlift-loader -->
</div><!-- .deadlift-loader-overlay -->
<?php
endif;
}
add_action( 'deadlift_body_start', 'deadlift_loading_animation_markup', 0 );
/**
* Add lateral menu for the vertical bar
*/
function deadlift_add_lateral_menu( $menus ) {
$menus['vertical'] = esc_html__( 'Vertical Menu (optional)', 'deadlift' );
return $menus;
}
add_filter( 'deadlift_menus', 'deadlift_add_lateral_menu' );
/**
* Login popup markup
*/
function deadlift_login_form_markup() {
if ( function_exists( 'wvc_login_form' ) && class_exists( 'WooCommerce' ) ) {
?>
<div id="loginform-overlay">
<div id="loginform-overlay-inner">
<div id="loginform-overlay-content" class="wvc-font-dark">
<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( 'deadlift_body_start', 'deadlift_login_form_markup', 5 );
/**
* Get available display options for posts
*
* @return array
*/
function deadlift_set_post_display_options() {
return array(
'standard' => esc_html__( 'Standard', 'deadlift' ),
// 'grid_square' => esc_html__( 'Modern Square Grid', 'deadlift' ),
'grid_classic' => esc_html__( 'Simple Grid', 'deadlift' ),
'masonry' => esc_html__( 'Masonry', 'deadlift' ),
);
}
add_filter( 'deadlift_post_display_options', 'deadlift_set_post_display_options' );
/**
* Set default metro thumbnail size dimension
*/
function deadlift_set_metro_thumbnail_sizes( $size ) {
add_image_size( 'deadlift-metro', 550, 702 );
}
// add_action( 'after_setup_theme', 'deadlift_set_metro_thumbnail_sizes', 44 );
/**
* Returns large
*/
function deadlift_set_large_metro_thumbnail_size() {
return 'large';
}
/**
* Filter metro thumnail size depending on row context
*/
function deadlift_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( 'deadlift_metro_thumbnail_size_name', 'deadlift_set_large_metro_thumbnail_size' );
}
}
}
add_action( 'wvc_add_row_filters', 'deadlift_optimize_metro_thumbnail_size', 10, 1 );
/* Remove metro thumbnail size filter */
add_action(
'wvc_remove_row_filters',
function() {
remove_filter( 'deadlift_metro_thumbnail_size_name', 'deadlift_set_large_metro_thumbnail_size' );
}
);
/**
* Get available display options for pages
*
* @return array
*/
function deadlift_set_page_display_options() {
return array(
'grid_overlay' => esc_html__( 'Image Grid', 'deadlift' ),
'masonry' => esc_html__( 'Masonry', 'deadlift' ),
);
}
add_filter( 'deadlift_page_display_options', 'deadlift_set_page_display_options' );
/**
* Get available display options for works
*
* @return array
*/
function deadlift_set_work_display_options() {
return array(
'grid' => esc_html__( 'Grid', 'deadlift' ),
'masonry' => esc_html__( 'Masonry', 'deadlift' ),
// 'text-background' => esc_html__( 'Text Background', 'deadlift' ),
);
}
add_filter( 'deadlift_work_display_options', 'deadlift_set_work_display_options' );
/**
* Portfolio masonry thumbnail size
*/
function deadlift_set_portfolio_masonry_thumbnail_size( $size ) {
if ( ! deadlift_is_gif( get_post_thumbnail_id() ) ) {
$size = 'deadlift-masonry-small';
}
return $size;
}
add_filter( 'deadlift_portfolio_masonry_thumbnail_size', 'deadlift_set_portfolio_masonry_thumbnail_size' );
/**
* Set portfolio template folder
*/
function deadlift_set_portfolio_template_url( $template_url ) {
return deadlift_get_template_url() . '/portfolio/';
}
add_filter( 'wolf_portfolio_template_url', 'deadlift_set_portfolio_template_url' );
/**
* Set videos template folder
*/
function deadlift_set_videos_template_url( $template_url ) {
return deadlift_get_template_url() . '/videos/';
}
add_filter( 'wolf_videos_template_url', 'deadlift_set_videos_template_url' );
/**
* Set video display
*
* @param string $string
* @return string
*/
function deadlift_set_video_display( $string ) {
return 'grid';
}
add_filter( 'deadlift_mod_video_display', 'deadlift_set_video_display', 44 );
/**
* Overwrite work post type taxonomy slug
*
* @param array $args
* @param string $taxonomy
* @return array $args
*/
function deadlift_overwrite_post_type_taxonomy_slug( $args, $taxonomy ) {
if ( $taxonomy === 'work_type' ) {
$args['rewrite']['slug'] = 'program-category';
}
return $args;
}
add_filter( 'register_taxonomy_args', 'deadlift_overwrite_post_type_taxonomy_slug', 10, 2 );
/**
* Overwrite work_type labels
*
* @param array $labels
* @return array $labels
*/
function deadlift_overwrite_portfolio_post_type_labels( $labels ) {
$labels['name'] = esc_html__( 'Programs', 'deadlift' );
$labels['singular_name'] = esc_html__( 'Program', 'deadlift' );
$labels['add_new'] = esc_html__( 'Add New', 'deadlift' );
$labels['add_new_item'] = esc_html__( 'Add New Program', 'deadlift' );
$labels['all_items'] = esc_html__( 'All Programs', 'deadlift' );
$labels['edit_item'] = esc_html__( 'Edit Program', 'deadlift' );
$labels['new_item'] = esc_html__( 'New Program', 'deadlift' );
$labels['view_item'] = esc_html__( 'View Program', 'deadlift' );
$labels['search_items'] = esc_html__( 'Search Programs', 'deadlift' );
$labels['not_found'] = esc_html__( 'No Program found', 'deadlift' );
$labels['not_found_in_trash'] = esc_html__( 'No Program found in Trash', 'deadlift' );
$labels['menu_name'] = esc_html__( 'Programs', 'deadlift' );
return $labels;
}
add_filter( 'wolf_work_post_type_labels', 'deadlift_overwrite_portfolio_post_type_labels' );
/**
* Output video single post meta
*/
function deadlift_ouput_video_meta() {
$post_id = get_the_ID();
$category = get_the_terms( $post_id, 'video_type', '', esc_html__( ', ', 'deadlift' ), '' );
$tags = get_the_terms( $post_id, 'video_tag', '', esc_html__( ', ', 'deadlift' ), '' );
$post_display_elements = deadlift_get_theme_mod( 'video_display_elements' );
$post_display_elements = deadlift_list_to_array( $post_display_elements );
$show_thumbnail = ( in_array( 'show_thumbnail', $post_display_elements ) );
$show_date = ( in_array( 'show_date', $post_display_elements ) );
$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 ) );
?>
<div class="video-entry-meta entry-meta">
<?php if ( $show_date ) : ?>
<span class="entry-date">
<?php deadlift_entry_date( true, true ); ?>
</span>
<?php endif; ?>
<?php if ( $show_author ) : ?>
<?php deadlift_get_author_avatar(); ?>
<?php endif; ?>
<?php if ( $show_category && $category ) : ?>
<span class="entry-category-list">
<?php echo apply_filters( 'deadlift_entry_category_list_icon', '<span class="meta-icon category-icon"></span>' ); ?>
<?php echo get_the_term_list( get_the_ID(), 'video_type', '', esc_html__( ', ', 'deadlift' ), '' ); ?>
</span>
<?php endif; ?>
<?php if ( $show_tags && $tags ) : ?>
<span class="entry-category-list">
<?php echo apply_filters( 'deadlift_entry_tag_list_icon', '<span class="meta-icon tag-icon"></span>' ); ?>
<?php echo get_the_term_list( get_the_ID(), 'video_tag', '', esc_html__( ', ', 'deadlift' ), '' ); ?>
</span>
<?php endif; ?>
<?php deadlift_get_extra_meta(); ?>
</div><!-- .video-meta -->
<?php
}
add_action( 'deadlift_video_meta', 'deadlift_ouput_video_meta' );
/**
* Set mobile menu template
*
* @param string $string Mobile menu template slug.
* @return string
*/
function deadlift_set_mobile_menu_template( $string ) {
return 'content-mobile-alt';
}
add_filter( 'deadlift_mobile_menu_template', 'deadlift_set_mobile_menu_template' );
/**
* Add mobile closer overlay
*/
function deadlift_add_mobile_panel_closer_overlay() {
?>
<div id="mobile-panel-closer-overlay" class="panel-closer-overlay toggle-mobile-menu"></div>
<?php
}
add_action( 'deadlift_main_content_start', 'deadlift_add_mobile_panel_closer_overlay' );
/**
* Disable live search
*
* @param bool $bool
* @return bool
*/
function deadlift_disable_livesearch( $bool ) {
return false;
}
add_filter( 'deadlift_live_search', 'deadlift_disable_livesearch' );
/**
* Search menu item
*/
function deadlift_filter_search_menu_item_html() {
$output = '';
$cta_content = deadlift_get_inherit_mod( 'menu_cta_content_type', 'search_icon' );
$type = ( 'shop_icons' === $cta_content ) ? 'shop' : 'blog';
/**
* Force shop icons on woocommerce pages
*/
$is_wc_page_child = is_page() && wp_get_post_parent_id( get_the_ID() ) == deadlift_get_woocommerce_shop_page_id() && deadlift_is_woocommerce();
$is_wc = deadlift_is_woocommerce_page() || is_singular( 'product' ) || $is_wc_page_child;
if ( apply_filters( 'deadlift_force_display_nav_shop_icons', $is_wc ) ) {
$type = 'shop';
}
if ( apply_filters( 'deadlift_force_nav_search_product', $is_wc ) ) {
$type = 'shop';
}
if ( deadlift_get_inherit_mod( 'menu_cta_content_type', 'search_product_icon' ) ) {
$type = 'shop';
}
if ( ! class_exists( 'WooCommerce' ) ) {
$type = 'blog';
}
if ( 'shop' === $type ) {
if ( function_exists( 'get_product_search_form' ) ) {
$output = get_product_search_form();
}
} else {
$output = get_search_form();
}
return $output;
}
add_filter( 'deadlift_search_menu_item_html', 'deadlift_filter_search_menu_item_html' );
add_filter(
'deadlift_cart_menu_item_mobile_html',
function() {
return '';
}
);
add_filter(
'deadlift_account_menu_item_mobile_html',
function() {
return '';
}
);
/**
* Off mobile menu
*/
function deadlift_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
*/
deadlift_primary_mobile_navigation();
?>
</div><!-- .mobile-menu-panel-inner -->
</div><!-- #mobile-menu-panel -->
<?php
}
add_action( 'deadlift_body_start', 'deadlift_mobile_alt_menu' );
/**
* Add panel closer icon
*/
function deadlift_add_side_panel_close_button() {
?>
<a href="#" id="close-side-panel-icon" class="close-panel-button toggle-side-panel">X</a>
<?php
}
add_action( 'deadlift_sidepanel_start', 'deadlift_add_side_panel_close_button' );
/**
* Add offcanvas menu closer icon
*/
function deadlift_add_offcanvas_menu_close_button() {
?>
<a href="#" id="close-side-panel-icon" class="close-panel-button toggle-offcanvas-menu">X</a>
<?php
}
add_action( 'deadlift_offcanvas_menu_start', 'deadlift_add_offcanvas_menu_close_button' );
/**
* Secondary navigation hook
*
* Display cart icons, social icons or secondary menu depending on cuzstimizer option
*/
function deadlift_output_mobile_complementary_menu( $context = 'desktop' ) {
if ( 'mobile' === $context ) {
$cta_content = deadlift_get_inherit_mod( 'menu_cta_content_type', 'none' );
/**
* Force shop icons on woocommerce pages
*/
$is_wc_page_child = is_page() && wp_get_post_parent_id( get_the_ID() ) == deadlift_get_woocommerce_shop_page_id() && deadlift_get_woocommerce_shop_page_id(); // phpcs:ignore
$is_wc = deadlift_is_woocommerce_page() || is_singular( 'product' ) || $is_wc_page_child;
if ( apply_filters( 'deadlift_force_display_nav_shop_icons', $is_wc ) ) { // can be disable just in case.
$cta_content = 'shop_icons';
}
if ( 'shop_icons' === $cta_content ) {
if ( deadlift_display_account_menu_item() ) :
?>
<div class="account-container cta-item">
<?php
/**
* account icon
*/
deadlift_account_menu_item();
?>
</div><!-- .cart-container -->
<?php
endif;
if ( deadlift_display_cart_menu_item() ) {
?>
<div class="cart-container cta-item">
<?php
/**
* Cart icon
*/
deadlift_cart_menu_item();
?>
</div><!-- .cart-container -->
<?php
}
}
}
}
add_action( 'deadlift_secondary_menu', 'deadlift_output_mobile_complementary_menu', 10, 1 );
/**
* Side Panel font class
*/
function deadlift_set_side_panel_class( $class ) {
if ( deadlift_get_theme_mod( 'side_panel_bg_img' ) ) {
$class .= ' wvc-font-light';
}
return $class;
}
add_filter( 'deadlift_side_panel_class', 'deadlift_set_side_panel_class' );
/**
* Overwrite hamburger icon
*/
function deadlift_set_hamburger_icon( $html, $class, $title_attr ) {
$title_attr = esc_html__( 'Menu', 'deadlift' );
ob_start();
?>
<a class="hamburger-icon <?php echo esc_attr( $class ); ?>" href="#" title="<?php echo esc_attr( $title_attr ); ?>">
<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>
</a>
<?php
$html = ob_get_clean();
return $html;
}
add_filter( 'deadlift_hamburger_icon', 'deadlift_set_hamburger_icon', 10, 3 );
/**
* Filter fullPage Transition
*
* @return array
*/
function deadlift_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', 'deadlift_set_fullpage_transition' );
/**
* Product Subheading
*/
function deadlift_add_product_subheading() {
$subheading = get_post_meta( get_the_ID(), '_post_subheading', true );
if ( 'product' === get_post_type() && $subheading ) {
?>
<span class="product-subheading">
<?php echo sanitize_text_field( $subheading ); ?>
</span>
<?php
}
}
add_action( 'deadlift_after_shop_loop_item_title', 'deadlift_add_product_subheading' );
add_action( 'deadlift_wc_after_widget_product_item_title', 'deadlift_add_product_subheading' );
add_action( 'wwcqv_product_summary', 'deadlift_add_product_subheading', 5 );
/**
* Single Product Subheading
*/
function deadlift_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', 'deadlift_add_single_product_subheading', 6 );
/**
* Set embed video title
*
* @param string $title
* @return string $title
*/
function wvc_set_embed_video_title( $title ) {
return esc_html__( '— %s', 'deadlift' );
}
add_filter( 'wvc_embed_video_title', 'wvc_set_embed_video_title', 40 );
/**
* Set default pie chart line width
*
* @param string $width
* @return string $width
*/
function wvc_set_default_pie_chart_line_width( $width ) {
return 10;
}
add_filter( 'wvc_default_pie_chart_line_width', 'wvc_set_default_pie_chart_line_width', 40 );
/**
* Set embed video title
*
* @param string $title
* @return string $title
*/
function deadlift_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', 'deadlift_set_default_video_opener_button', 40 );
/**
* Related post count
*/
add_filter(
'deadlift_related_posts_count',
function() {
return 6;
}
);
/**
* Standard row width
*/
add_filter(
'wvc_row_standard_width',
function( $string ) {
return '1300px';
},
40
);
/**
* Load more pagination hash change
*/
add_filter(
'deadlift_loadmore_pagination_hashchange',
function( $size ) {
return false;
},
40
);
/**
* WC gallery aimeg size overwrite
*/
add_filter(
'woocommerce_gallery_thumbnail_size',
function( $size ) {
return array( 100, 137 );
},
40
);
/**
* Category thumbnail fields.
*/
function deadlift_add_category_fields() {
?>
<div class="form-field term-thumbnail-wrap">
<label><?php esc_html_e( 'Size Chart', 'deadlift' ); ?></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', 'deadlift' ); ?></button>
<button type="button" id="remove_sizechart_image_button" class="remove_sizechart_image_button button" style="display:none;"><?php esc_html_e( 'Remove image', 'deadlift' ); ?></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', 'deadlift' ); ?>',
button: {
text: '<?php esc_html_e( 'Use image', 'deadlift' ); ?>'
},
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', 'deadlift_add_category_fields', 100 );
/**
* Edit category thumbnail field.
*
* @param mixed $term Term (category) being edited
*/
function deadlift_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', 'deadlift' ); ?></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', 'deadlift' ); ?></button>
<button type="button" id="remove_sizechart_image_button" class="remove_sizechart_image_button button" style="display:none;"><?php esc_html_e( 'Remove image', 'deadlift' ); ?></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', 'deadlift' ); ?>',
button: {
text: '<?php esc_html_e( 'Use image', 'deadlift' ); ?>'
},
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', 'deadlift_edit_category_fields', 100 );
/**
* save_category_fields function.
*
* @param mixed $term_id Term ID being saved
* @param mixed $tt_id
* @param string $taxonomy
*/
function deadlift_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', 'deadlift_save_category_fields', 10, 3 );
add_action( 'edit_term', 'deadlift_save_category_fields', 10, 3 );
/**
* Product Size Chart Image
*/
function deadlift_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 = deadlift_get_url_from_attachment_id( $sc_img, 'deadlift-XL' );
?>
<div class="size-chart-img">
<a href="<?php echo esc_url( $href ); ?>" class="lightbox"><?php esc_html_e( 'Size Chart', 'deadlift' ); ?></a>
</div>
<?php
}
}
add_action( 'woocommerce_single_product_summary', 'deadlift_product_size_chart_img', 25 );
/**
* Filter single work title
*
* @param string $string
* @return string
*/
function deadlift_set_single_work_title( $string ) {
return esc_html__( 'Details & Info', 'deadlift' );
}
add_filter( 'deadlift_single_work_title', 'deadlift_set_single_work_title', 40 );
/**
* Add cusotm fields in work meta
*/
add_action(
'deadlift_work_meta',
function() {
deadlift_the_work_meta();
},
15
);
add_filter(
'deadlift_work_meta_separator',
function() {
return ' : ';
}
);
add_filter(
'deadlift_no_work_text',
function() {
return esc_html__( 'No program yet.', 'deadlift' );
}
);
add_filter(
'deadlift_entry_tag_list_separator',
function() {
return ' / ';
}
);
/**
* 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', 'deadlift' ); ?></span>
<?php deadlift_add_to_wishlist(); ?>
</div><!-- .single-add-to-wishlist -->
<?php
},
20
);
/**
* After summary hook
*/
add_action(
'woocommerce_single_product_summary',
function() {
?>
<div class="single-add-to-wishlist">
<span class="single-add-to-wishlist-label"><?php esc_html_e( 'Wishlist', 'deadlift' ); ?></span>
<?php deadlift_add_to_wishlist(); ?>
</div><!-- .single-add-to-wishlist -->
<?php
},
25
);
/**
* No header post types
*
* @param array $post_types Post types where the default hero block is disabled.
* @return array
*/
function deadlift_filter_no_hero_post_types( $post_types ) {
$post_types = array( 'product', 'attachment' );
return $post_types;
}
add_filter( 'deadlift_no_header_post_types', 'deadlift_filter_no_hero_post_types', 40 );
function deadlift_show_shop_header_content_block_single_product( $bool ) {
if ( is_singular( 'product' ) ) {
$bool = true;
}
return $bool;
}
add_filter( 'deadlift_force_display_shop_after_header_block', 'deadlift_show_shop_header_content_block_single_product' );
/**
* Disable single post pagination
*
* @param bool $bool
* @return bool
*/
add_filter( 'deadlift_disable_single_post_pagination', '__return_true' );
/**
* Read more text
*/
function deadlift_view_post_text( $string ) {
return esc_html__( 'Read more', 'deadlift' );
}
add_filter( 'deadlift_view_post_text', 'deadlift_view_post_text' );
/**
* Search form placeholder
*/
function deadlift_set_searchform_placeholder( $string ) {
return esc_attr_x( 'Search…', 'placeholder', 'deadlift' );
}
add_filter( 'deadlift_searchform_placeholder', 'deadlift_set_searchform_placeholder', 40 );
add_filter( 'deadlift_product_searchform_placeholder', 'deadlift_set_searchform_placeholder', 40 );
/**
* Filter WVC theme accent color
*
* @param string $color
* @return string $color
*/
function deadlift_set_wvc_secondary_theme_accent_color( $color ) {
return deadlift_get_inherit_mod( 'secondary_accent_color' );
}
add_filter( 'wvc_theme_secondary_accent_color', 'deadlift_set_wvc_theme_secondary_accent_color' );
/**
* Add theme secondary accent color to shared colors
*
* @param array $colors
* @return array $colors
*/
function deadlift_wvc_add_secondary_accent_color_option( $colors ) {
$colors = array( esc_html__( 'Theme Secondary Accent Color', 'deadlift' ) => 'secondary_accent' ) + $colors;
return $colors;
}
add_filter( 'wvc_shared_colors', 'deadlift_wvc_add_secondary_accent_color_option' );
/**
* Filter WVC shared color hex
*
* @param array $colors
* @return array $colors
*/
function deadlift_add_secondary_accent_color_hex( $colors ) {
$secondary_accent_color = get_theme_mod( 'secondary_accent_color' );
if ( $secondary_accent_color ) {
$colors['secondary_accent'] = $secondary_accent_color;
}
return $colors;
}
add_filter( 'wvc_shared_colors_hex', 'deadlift_add_secondary_accent_color_hex' );
/**
* Add form in no result page
*/
function deadlift_add_no_result_form() {
get_search_form();
}
add_action( 'deadlift_no_result_end', 'deadlift_add_no_result_form' );
/**
* Remove unused mods
*
* @param array $mods The default mods.
* @return void
*/
function deadlift_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_hover_style'] );
unset( $mods['navigation']['options']['menu_layout']['choices']['overlay'] );
unset( $mods['navigation']['options']['menu_layout']['choices']['lateral'] );
unset( $mods['navigation']['options']['menu_layout']['choices']['offcanvas'] );
unset( $mods['navigation']['options']['menu_skin'] );
unset( $mods['header_settings']['options']['hero_scrolldown_arrow'] );
// unset( $mods['blog']['options']['post_display'] );
return $mods;
}
add_filter( 'deadlift_customizer_mods', 'deadlift_remove_mods', 20 );
/**
* Disable parallax effect in masonry
*
* @param string $string
* @return string
*/
function deadlift_disable_masonry_parallax_effect( $string ) {
return 'none';
}
add_filter( 'deadlift_masonry_modern_image_format_effect', 'deadlift_disable_masonry_parallax_effect' );
/**
* Custom button types
*/
function deadlift_custom_button_types() {
return array(
esc_html__( 'Default', 'deadlift' ) => 'default',
esc_html__( 'Special Primary', 'deadlift' ) => 'deadlift-button-special-primary',
esc_html__( 'Special Secondary', 'deadlift' ) => 'deadlift-button-special-secondary',
esc_html__( 'Primary', 'deadlift' ) => 'deadlift-button-primary',
esc_html__( 'Secondary', 'deadlift' ) => 'deadlift-button-secondary',
esc_html__( 'Primary Alt', 'deadlift' ) => 'deadlift-button-primary-alt',
esc_html__( 'Secondary Alt', 'deadlift' ) => 'deadlift-button-secondary-alt',
esc_html__( 'Simple Text', 'deadlift' ) => 'deadlift-button-simple',
);
}
/**
* Custom backgorund effect output
*/
function deadlift_get_filmgrain( $html ) {
ob_start();
?>
<div class="deadlift-bg-overlay"></div>
<?php
$html = ob_get_clean();
return $html;
}
add_filter( 'wvc_background_effect', 'deadlift_get_filmgrain' );
/**
* Custom backgorund effect output
*/
function deadlift_output_filmgrain_effect() {
?>
<div class="deadlift-bg-overlay"></div>
<?php
}
// add_action( 'deadlift_overlay_menu_panel_start', 'deadlift_output_filmgrain_effect', 40 );
// add_action( 'deadlift_sidepanel_start', 'deadlift_output_filmgrain_effect', 40 );
// add_action( 'deadlift_lateral_menu_panel_start', 'deadlift_output_filmgrain_effect', 40 );
// add_action( 'deadlift_offcanvas_menu_start', 'deadlift_output_filmgrain_effect', 40 );
/**
* Add deadlift background effect
*
* @param string $effects
* @return string $effects
*/
function deadlift_add_wvc_custom_background_effect( $effects ) {
if ( function_exists( 'vc_add_param' ) ) {
vc_add_param(
'vc_row',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
'group' => esc_html__( 'Style', 'deadlift' ),
)
);
vc_add_param(
'vc_row',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Preload Animation', 'deadlift' ),
'param_name' => 'background_img_preloader',
'group' => esc_html__( 'Style', 'deadlift' ),
)
);
vc_add_param(
'vc_column',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
'group' => esc_html__( 'Style', 'deadlift' ),
)
);
vc_add_param(
'vc_column_inner',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
'group' => esc_html__( 'Style', 'deadlift' ),
)
);
vc_add_param(
'wvc_advanced_slide',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
// 'group' => esc_html__( 'Background', 'deadlift' ),
)
);
vc_add_param(
'wvc_interactive_link_item',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
'group' => esc_html__( 'Background', 'deadlift' ),
)
);
vc_add_param(
'vc_column',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Add Film Grain Effect', 'deadlift' ),
'param_name' => 'add_effect',
'group' => esc_html__( 'Style', 'deadlift' ),
)
);
// vc_add_param(
// 'wvc_work_index',
// array(
// 'param_name' => 'work_layout',
// 'heading' => esc_html__( 'Layout', 'deadlift' ),
// 'type' => 'dropdown',
// 'value' => array(
// esc_html__( 'Classic', 'deadlift' ) => 'standard',
// esc_html__( 'Overlay', 'deadlift' ) => 'overlay',
// esc_html__( 'Noise Overlay', 'deadlift' ) => 'add_noise',
// ),
// 'admin_label' => true,
// 'dependency' => array(
// 'element' => 'work_display',
// 'value_not_equal_to' => array( 'list_minimal' )
// ),
// )
// );
vc_add_param(
'rev_slider_vc',
array(
'type' => 'checkbox',
'heading' => esc_html__( 'Preloader Background', 'deadlift' ),
'param_name' => 'preloader_bg',
)
);
}
}
add_action( 'init', 'deadlift_add_wvc_custom_background_effect' );
/**
* Add theme button option
*/
function deadlift_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( '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 );
}
add_action( 'init', 'deadlift_add_button_dependency_params', 15 );
/**
* 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' );
/**
* Filter 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_elements_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'] = '';
if ( isset( $btn_params['el_class'] ) ) {
$btn_params['el_class'] .= ' ' . $atts['btn_button_type'];
} else {
$btn_params['el_class'] = ' ' . $atts['btn_button_type'];
}
}
if ( isset( $atts['b1_button_type'] ) && 'default' !== $atts['b1_button_type'] ) {
$btn_params['shape'] = '';
$btn_params['color'] = '';
$btn_params['hover_effect'] = '';
if ( isset( $btn_params['el_class'] ) ) {
$btn_params['el_class'] .= ' ' . $atts['b1_button_type'];
} else {
$btn_params['el_class'] = ' ' . $atts['b1_button_type'];
}
}
// if ( isset( $atts['b2_button_type'] ) && 'default' !== $atts['b2_button_type'] ) {
// $btn_params['shape'] = '';
// $btn_params['color'] = '';
// $btn_params['hover_effect'] = '';
// if ( isset( $btn_params['el_class'] ) ) {
// $btn_params['el_class'] .= ' ' . $atts['b2_button_type'];
// } else {
// $btn_params['el_class'] = ' ' . $atts['b2_button_type'];
// }
// }
return $btn_params;
}
add_filter( 'wvc_cta_button_atts', 'woltheme_filter_elements_button_atts', 10, 2 );
add_filter( 'wvc_banner_button_atts', 'woltheme_filter_elements_button_atts', 10, 2 );
add_filter( 'wvc_advanced_slider_b1_button_atts', 'woltheme_filter_elements_button_atts', 10, 2 );
add_filter(
'wvc_advanced_slider_b2_button_atts',
function( $btn_params, $atts ) {
if ( isset( $atts['b2_button_type'] ) && 'default' !== $atts['b2_button_type'] ) {
$btn_params['shape'] = '';
$btn_params['color'] = '';
$btn_params['hover_effect'] = '';
if ( isset( $btn_params['el_class'] ) ) {
$btn_params['el_class'] .= ' ' . $atts['b2_button_type'];
} else {
$btn_params['el_class'] = ' ' . $atts['b2_button_type'];
}
}
return $btn_params;
},
10,
2
);
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
);
/**
* Add theme button option to Button element
*/
function deadlift_add_theme_buttons() {
if ( function_exists( 'vc_add_params' ) ) {
vc_add_params(
'vc_button',
array(
array(
'heading' => esc_html__( 'Button Type', 'deadlift' ),
'param_name' => 'button_type',
'type' => 'dropdown',
'value' => deadlift_custom_button_types(),
'weight' => 1000,
),
)
);
vc_add_params(
'vc_cta',
array(
array(
'heading' => esc_html__( 'Button Type', 'deadlift' ),
'param_name' => 'btn_button_type',
'type' => 'dropdown',
'value' => deadlift_custom_button_types(),
'weight' => 10,
'group' => esc_html__( 'Button', 'deadlift' ),
),
)
);
vc_add_params(
'wvc_banner',
array(
array(
'heading' => esc_html__( 'Button Type', 'deadlift' ),
'param_name' => 'btn_button_type',
'type' => 'dropdown',
'value' => deadlift_custom_button_types(),
// 'weight' => 10,
'group' => esc_html__( 'Button', 'deadlift' ),
),
)
);
vc_add_params(
'wvc_advanced_slide',
array(
array(
'heading' => esc_html__( 'Button Type', 'deadlift' ),
'param_name' => 'b1_button_type',
'type' => 'dropdown',
'value' => deadlift_custom_button_types(),
'weight' => 10,
'group' => esc_html__( 'Button 1', 'deadlift' ),
'dependency' => array(
'element' => 'add_button_1',
'value' => array( 'true' ),
),
),
)
);
vc_add_params(
'wvc_advanced_slide',
array(
array(
'heading' => esc_html__( 'Button Type', 'deadlift' ),
'param_name' => 'b2_button_type',
'type' => 'dropdown',
'value' => deadlift_custom_button_types(),
'weight' => 10,
'group' => esc_html__( 'Button 2', 'deadlift' ),
'dependency' => array(
'element' => 'add_button_2',
'value' => array( 'true' ),
),
),
)
);
// vc_add_params(
// 'vc_custom_heading',
// array(
// array(
// 'heading' => esc_html__( 'Style', 'deadlift' ),
// 'param_name' => 'style',
// 'type' => 'dropdown',
// 'value' => array(
// esc_html__( 'Theme Style', 'deadlift' ) => 'deadlift-heading',
// esc_html__( 'Default', 'deadlift' ) => '',
// ),
// 'weight' => 10,
// ),
// )
// );
}
}
add_action( 'init', 'deadlift_add_theme_buttons' );
/**
* Add style option to tabs element
*/
function deadlift_add_vc_accordion_and_tabs_options() {
if ( function_exists( 'vc_add_params' ) ) {
vc_add_params(
'vc_tabs',
array(
array(
'heading' => esc_html__( 'Background', 'deadlift' ),
'param_name' => 'background',
'type' => 'dropdown',
'value' => array(
esc_html__( 'Solid', 'deadlift' ) => 'solid',
esc_html__( 'Transparent', 'deadlift' ) => 'transparent',
),
'weight' => 1000,
),
)
);
}
if ( function_exists( 'vc_add_params' ) ) {
vc_add_params(
'vc_accordion',
array(
array(
'heading' => esc_html__( 'Background', 'deadlift' ),
'param_name' => 'background',
'type' => 'dropdown',
'value' => array(
esc_html__( 'Solid', 'deadlift' ) => 'solid',
esc_html__( 'Transparent', 'deadlift' ) => 'transparent',
),
'weight' => 1000,
),
)
);
}
}
add_action( 'init', 'deadlift_add_vc_accordion_and_tabs_options' );
/**
* Filter tabs shortcode attribute
*/
function deadlift_add_vc_tabs_params( $params ) {
if ( isset( $params['background'] ) ) {
$params['el_class'] = $params['el_class'] . ' wvc-tabs-background-' . $params['background'];
}
return $params;
}
add_filter( 'shortcode_atts_vc_tabs', 'deadlift_add_vc_tabs_params' );
/**
* Filter accordion shortcode attribute
*/
function deadlift_add_vc_accordion_params( $params ) {
if ( isset( $params['background'] ) ) {
$params['el_class'] = $params['el_class'] . ' wvc-accordion-background-' . $params['background'];
}
return $params;
}
add_filter( 'shortcode_atts_vc_accordion', 'deadlift_add_vc_accordion_params' );
/**
* Set default button shape
*
* @param string $shape
* @return string $shape
*/
function deadlift_set_default_wvc_button_shape( $shape ) {
return 'boxed';
}
add_filter( 'wvc_default_button_shape', 'deadlift_set_default_wvc_button_shape', 40 );
/**
* Set default button shape
*
* @param string $shape
* @return string $shape
*/
function deadlift_set_default_theme_button_shape( $shape ) {
return 'square';
}
add_filter( 'deadlift_mod_button_style', 'deadlift_set_default_theme_button_shape', 40 );
/**
* Set default button font weight
*
* @param string $shape
* @return string $shape
*/
function deadlift_set_default_wvc_button_font_weight( $font_weight ) {
return 700;
}
add_filter( 'wvc_button_default_font_weight', 'deadlift_set_default_wvc_button_font_weight', 40 );
/**
* Set default icon font
*
* @param string $shape
* @return string $shape
*/
function deadlift_set_default_icon_font( $shape ) {
return 'elegant-icons';
}
add_filter( 'wvc_default_icon_font', 'deadlift_set_default_icon_font', 40 );
/**
* Added selector to menu_selectors
*
* @param array $selectors navigation items CSS selectors.
* @return array $selectors
*/
function deadlift_add_menu_selectors( $selectors ) {
$selectors[] = '.category-filter ul li a';
$selectors[] = '.mptt-navigation-tabs li a';
$selectors[] = '.cart-panel-buttons a';
return $selectors;
}
add_filter( 'deadlift_menu_selectors', 'deadlift_add_menu_selectors' );
/**
* Added selector to heading_family_selectors
*
* @param array $selectors headings related CSS selectors.
* @return array $selectors
*/
function deadlift_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[] = '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[] = '.deadlift-button-dir-aware';
$selectors[] = '.preqelle-button-dir-aware-alt';
$selectors[] = '.deadlift-button-outline';
$selectors[] = '.deadlift-button-outline-alt';
$selectors[] = '.deadlift-button-simple';
$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[] = '#deadlift-percent';
$selectors[] = '.wvc-workout-program-title';
$selectors[] = '.wvc-meal-title';
$selectors[] = '.wvc-recipe-title';
$selectors[] = '.wvc-pie-counter';
return $selectors;
}
add_filter( 'deadlift_heading_family_selectors', 'deadlift_add_heading_family_selectors' );
/**
* Added selector to heading_family_selectors
*
* @param array $selectors headings related CSS selectors.
* @return array $selectors
*/
function deadlift_add_deadlift_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[] = '.wvc-workout-program-title';
$selectors[] = '.wvc-meal-title';
$selectors[] = '.wvc-recipe-title';
return $selectors;
}
add_filter( 'deadlift_heading_selectors', 'deadlift_add_deadlift_heading_selectors' );
/**
* Set default heading font size
*
* @param int $font_size
* @return int $font_size
*/
function wvc_set_default_custom_heading_font_size( $font_size ) {
return 36;
}
add_filter( 'wvc_default_custom_heading_font_size', 'wvc_set_default_custom_heading_font_size', 40 );
/**
* Set default heading font size
*
* @param int $font_size
* @return int $font_size
*/
function wvc_set_advanced_slide_title_font_size( $font_size ) {
return 54;
}
add_filter( 'wvc_default_advanced_slide_title_font_size', 'wvc_set_default_custom_heading_font_size', 40 );
/**
* Set default heading font weight
*
* @param int $font_weight
* @return int $font_weight
*/
function wvc_set_default_custom_heading_font_weight( $font_weight ) {
return 700;
}
add_filter( 'wvc_default_custom_heading_font_weight', 'wvc_set_default_custom_heading_font_weight', 40 );
add_filter( 'wvc_default_advanced_slide_title_font_weight', 'wvc_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 24;
}
add_filter( 'wvc_default_cta_font_size', 'wvc_set_default_cta_font_size', 40 );
/**
* Set default team member layout
*
* @param string $layout
* @return string $layout
*/
function wvc_set_default_team_member_layout( $args ) {
return 'overlay';
}
add_filter( 'wvc_default_team_member_layout', 'wvc_set_default_team_member_layout', 40 );
/**
* Set default team member socials_args
*
* @param string $args
* @return string $args
*/
function wvc_set_default_team_member_socials_args( $args ) {
$args['background_style'] = 'rounded';
$args['background_color'] = 'white';
$args['custom_color'] = '#000000';
$args['size'] = 'fa-1x';
return $args;
}
add_filter( 'wvc_team_member_socials_args', 'wvc_set_default_team_member_socials_args', 40 );
/**
* 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 24;
}
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 );
/**
* Primary buttons class
*
* @param string $string
* @return string
*/
function deadlift_set_primary_button_class( $class ) {
$deadlift_button_class = 'deadlift-button-primary-alt';
$class = $deadlift_button_class . ' wvc-button wvc-button-size-xs';
return $class;
}
add_filter( 'wvc_last_posts_big_slide_button_class', 'deadlift_set_primary_button_class' );
add_filter( 'deadlift_404_button_class', 'deadlift_set_primary_button_class' );
add_filter( 'deadlift_post_product_button', 'deadlift_set_primary_button_class' );
/**
* Load more buttons class
*
* @param string $string
* @return string
*/
function deadlift_set_loadmore_button_class( $class ) {
$hyperbent_button_class = 'deadlift-button-primary-alt';
$class = $hyperbent_button_class . ' wvc-button wvc-button-size-lg';
return $class;
}
add_filter( 'deadlift_loadmore_button_class', 'deadlift_set_loadmore_button_class' );
/**
* Reod more buttons class
*
* @param string $string
* @return string
*/
function deadlift_set_readmore_button_class( $class ) {
$hyperbent_button_class = 'deadlift-button-simple';
$class = $hyperbent_button_class . ' wvc-button wvc-button-size-sm';
return $class;
}
add_filter( 'deadlift_more_link_button_class', 'deadlift_set_readmore_button_class' );
/**
* Author box buttons class
*
* @param string $string
* @return string
*/
function deadlift_set_author_box_button_class( $class ) {
$class = ' wvc-button wvc-button-size-xs deadlift-button-primary-alt';
return $class;
}
add_filter( 'deadlift_author_page_link_button_class', 'deadlift_set_author_box_button_class' );
/**
* Set entry author prefix
*
* @param string $icon
* @return string $icon
*/
function deadlift_set_author_name_meta( $author_name ) {
return sprintf( esc_html__( 'By %s', 'deadlift' ), '<span class="author-name">' . $author_name . '</span>' );
}
add_filter( 'deadlift_author_name_meta', 'deadlift_set_author_name_meta', 40 );
/**
* Excerpt more
*
* Add span to allow more CSS tricks
*
* @return string
*/
function deadlift_custom_more_text( $string ) {
$text = '<span>' . esc_html__( 'Read more', 'deadlift' ) . '</span>';
return $text;
}
add_filter( 'deadlift_more_text', 'deadlift_custom_more_text', 40 );
/**
* Filter empty p tags in excerpt
*/
function deadlift_filter_excerpt_empty_p_tags( $excerpt ) {
return str_replace( '<p></p>', '', $excerpt );
}
add_filter( 'get_the_excerpt', 'deadlift_filter_excerpt_empty_p_tags', 100 );
/**
* Set entry slider animation
*
* @param string $animation
* @return string $animation
*/
function deadlift_set_entry_slider_animation( $animation ) {
return 'slide';
}
add_filter( 'deadlift_entry_slider_animation', 'deadlift_set_entry_slider_animation', 40 );
/**
* Set default item overlay color
*
* @param string $color
* @return string $color
*/
function deadlift_set_default_item_overlay_color( $color ) {
return 'accent';
}
add_filter( 'wvc_default_item_overlay_color', 'deadlift_set_default_item_overlay_color', 40 );
/**
* Set default item overlay text color
*
* @param string $color
* @return string $color
*/
function deadlift_set_item_overlay_text_color( $color ) {
return 'white';
}
add_filter( 'wvc_default_item_overlay_text_color', 'deadlift_set_item_overlay_text_color', 40 );
/**
* Set default item overlay opacity
*
* @param int $color
* @return int $color
*/
function deadlift_set_item_overlay_opacity( $opacity ) {
return 100;
}
add_filter( 'wvc_default_item_overlay_opacity', 'deadlift_set_item_overlay_opacity', 40 );
/**
* Excerpt length hook
* Set the number of character to display in the excerpt
*
* @param int $length
* @return int
*/
function deadlift_overwrite_excerpt_length( $length ) {
return 14;
}
add_filter( 'deadlift_excerpt_length', 'deadlift_overwrite_excerpt_length' );
/**
* Excerpt length hook
* Set the number of character to display in the excerpt
*
* @param int $length
* @return int
*/
function deadlift_overwrite_sticky_menu_height( $length ) {
return 60;
}
add_filter( 'deadlift_sticky_menu_height', 'deadlift_overwrite_sticky_menu_height' );
/**
* Set menu skin
*
* @param string $skin
* @return string $skin
*/
function deadlift_set_menu_skin( $skin ) {
return 'light';
}
add_filter( 'deadlift_mod_menu_skin', 'deadlift_set_menu_skin', 40 );
/**
* Set menu hover effect
*
* @param string $string
* @return string
*/
function deadlift_set_menu_hover_style( $string ) {
return 'plain-slide';
}
add_filter( 'deadlift_mod_menu_hover_style', 'deadlift_set_menu_hover_style' );
/*
=========================================
Loop posts
==========================================*/
/**
* Redefine post standard hook
*/
function deadlift_remove_loop_post_default_hooks() {
remove_action( 'deadlift_before_post_content_standard_title', 'deadlift_output_post_content_standard_date' );
remove_action( 'deadlift_after_post_content_standard', 'deadlift_output_post_content_standard_meta' );
add_action( 'deadlift_before_post_content_standard_title', 'deadlift_output_post_content_standard_top_meta', 10, 1 );
}
add_action( 'init', 'deadlift_remove_loop_post_default_hooks' );
/**
* Add post meta before title
*/
function deadlift_output_post_content_standard_top_meta( $post_display_elements ) {
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() ) {
?>
<span class="entry-date">
<?php deadlift_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 || deadlift_edit_post_link( false ) ) && ! deadlift_is_short_post_format() ) : ?>
<?php if ( $show_author ) : ?>
<?php deadlift_get_author_avatar(); ?>
<?php endif; ?>
<?php if ( $show_category ) : ?>
<span class="entry-category-list">
<?php echo apply_filters( 'deadlift_entry_category_list_icon', '<span class="meta-icon category-icon"></span>' ); ?>
<?php echo get_the_term_list( get_the_ID(), 'category', '', esc_html__( ', ', 'deadlift' ), '' ); ?>
</span>
<?php endif; ?>
<?php if ( $show_tags ) : ?>
<?php deadlift_entry_tags(); ?>
<?php endif; ?>
<?php if ( $show_extra_meta ) : ?>
<?php deadlift_get_extra_meta(); ?>
<?php endif; ?>
<?php deadlift_edit_post_link(); ?>
<?php endif; ?>
<?php
echo '</header>';
}
/**
* Get available display options for products
*
* @return array
*/
function deadlift_set_product_display_options() {
return array(
'grid' => esc_html__( 'Grid', 'deadlift' ),
'metro' => esc_html__( 'Metro', 'deadlift' ),
);
}
add_filter( 'deadlift_product_display_options', 'deadlift_set_product_display_options' );
/**
* Set default shop display
*
* @param string $string
* @return string
*/
function deadlift_set_product_display( $string ) {
return 'grid';
}
add_filter( 'deadlift_mod_product_display', 'deadlift_set_product_display' );
/**
* Display sale label condition
*
* @param bool $bool
* @return bool
*/
function deadlift_do_show_sale_label( $bool ) {
if ( get_post_meta( get_the_ID(), '_post_product_label', true ) ) {
$bool = true;
}
return $bool;
}
add_filter( 'deadlift_show_sale_label', 'deadlift_do_show_sale_label' );
/**
* Sale label text
*
* @param string $string
* @return string
*/
function deadlift_sale_label( $string ) {
if ( get_post_meta( get_the_ID(), '_post_product_label', true ) ) {
$string = '<span class="onsale">' . esc_attr( get_post_meta( get_the_ID(), '_post_product_label', true ) ) . '</span>';
}
return $string;
}
add_filter( 'woocommerce_sale_flash', 'deadlift_sale_label' );
/**
* Product quickview button
*
* @param string $string
* @return string
*/
function deadlift_output_product_quickview_button( $product ) {
if ( function_exists( 'wolf_quickview_button' ) && $product ) {
$text = esc_html__( 'Quick Buy', 'deadlift' );
?>
<a
class="product-quickview-button wwcq-product-quickview-button"
href="<?php echo get_permalink( $product->get_id() ); ?>"
title="<?php echo esc_attr( $text ); ?>"
rel="nofollow"
data-product-title="<?php echo esc_attr( $product->get_title() ); ?>"
data-product-id="<?php echo absint( $product->get_id() ); ?>"><?php echo esc_attr( $text ); ?></a>
<?php
}
}
add_filter( 'deadlift_product_quickview_button', 'deadlift_output_product_quickview_button' );
/**
* Product wishlist button
*
* @param string $string
* @return string
*/
function deadlift_output_product_wishlist_button() {
if ( function_exists( 'wolf_add_to_wishlist' ) ) {
wolf_add_to_wishlist();
}
}
add_filter( 'deadlift_add_to_wishlist_button', 'deadlift_output_product_wishlist_button' );
/**
* Product Add to cart button
*
* @param string $string
* @return string
*/
function deadlift_output_product_add_to_cart_button() {
global $product;
if ( $product->is_type( 'variable' ) ) {
echo '<a class="product-add-to-cart" href="' . esc_url( get_permalink() ) . '"><span class="hastip fa product-add-to-cart-icon" title="' . esc_attr( __( 'Select option', 'deadlift' ) ) . '"></span></a>';
} elseif ( $product->is_type( 'external' ) || $product->is_type( 'grouped' ) ) {
echo '<a class="product-add-to-cart" href="' . esc_url( get_permalink() ) . '"><span class="hastip fa product-add-to-cart-icon" title="' . esc_attr( __( 'View product', 'deadlift' ) ) . '"></span></a>';
} else {
echo deadlift_add_to_cart(
get_the_ID(),
'product-add-to-cart',
'<span class="hastip fa product-add-to-cart-icon" title="' . esc_attr( __( 'Add to cart', 'deadlift' ) ) . '"></span>'
);
}
}
add_filter( 'deadlift_product_add_to_cart_button', 'deadlift_output_product_add_to_cart_button' );
/**
* Product more button
*
* @param string $string
* @return string
*/
function deadlift_output_product_more_button() {
?>
<a class="product-quickview-button product-more-button" href="<?php the_permalink(); ?>" title="<?php esc_attr_e( 'More details', 'deadlift' ); ?>"><span class="fa ion-android-more-vertical"></span></a>
<?php
}
add_filter( 'deadlift_product_more_button', 'deadlift_output_product_more_button' );
/*
=========================================
Loop mp events
==========================================*/
/**
* Set default mp event display
*
* @param string $string
* @return string
*/
function deadlift_set_mp_event_display( $string ) {
return 'grid';
}
add_filter( 'deadlift_mod_mp_event_display', 'deadlift_set_mp_event_display' );
/**
* Output background
*/
function deadlift_output_mp_event_content_grid_background_color( $template_args ) {
$overlay_color = ( is_array( $template_args ) && isset( $template_args['overlay_color'] ) ) ? esc_attr( $template_args['overlay_color'] ) : null;
if ( $overlay_color ) {
echo '<div class="entry-mp-event-bg wvc-background-color-' . $overlay_color . '"></div>';
}
}
add_action( 'deadlift_before_mp_event_content_grid', 'deadlift_output_mp_event_content_grid_background_color', 10, 1 );
/**
* Output link mask
*/
function deadlift_output_mp_event_content_grid_link_mask() {
echo '<a href="' . get_the_permalink() . '" class="entry-link-mask"></a>';
}
add_action( 'deadlift_before_mp_event_content_grid', 'deadlift_output_mp_event_content_grid_link_mask' );
/**
* Output open tag
*/
function deadlift_output_mp_event_content_grid_open_tag() {
echo '<div class="entry-inner">';
}
add_action( 'deadlift_before_mp_event_content_grid_title', 'deadlift_output_mp_event_content_grid_open_tag' );
/**
* Output closing tag
*/
function deadlift_output_mp_event_content_grid_closing_tag() {
echo '</div><!--.entry-inner-->';
}
add_action( 'deadlift_after_mp_event_content_grid', 'deadlift_output_mp_event_content_grid_closing_tag' );
/**
* Output thumbnail
*/
function deadlift_output_mp_event_content_grid_thumbnail() {
echo '<div class="entry-image">';
echo deadlift_background_img(
array(
'background_img_size' => 'large',
)
);
echo '</div>';
}
add_action( 'deadlift_before_mp_event_content_grid', 'deadlift_output_mp_event_content_grid_thumbnail' );
/**
* Output category
*/
function deadlift_output_mp_event_content_grid_category() {
}
add_action( 'deadlift_before_mp_event_content_grid_title', 'deadlift_output_mp_event_content_grid_category' );
/**
* Output title
*/
function deadlift_output_mp_event_content_grid_title() {
// echo '<a href="' . get_the_permalink() . '">';
the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h3>' );
// echo '</a>';
}
add_action( 'deadlift_mp_event_content_grid_title', 'deadlift_output_mp_event_content_grid_title' );
/**
* Output exerpt
*/
function deadlift_output_mp_event_content_grid_exerpt() {
if ( get_the_excerpt() ) {
echo '<div class="entry-excerpt">';
echo '<p>' . deadlift_sample( get_the_excerpt(), 14 ) . '</p>';
echo '<p class="mp-event-grid-read-more-container"><a href="' . esc_url( get_permalink() ) . '" class="' . esc_attr( apply_filters( 'deadlift_more_link_button_class', 'more-link' ) ) . '">' . esc_html__( 'Read more', 'deadlift' ) . '</a></p>';
echo '</div>';
}
}
add_action( 'deadlift_after_mp_event_content_grid_title', 'deadlift_output_mp_event_content_grid_exerpt' );
/*
=========================================
Loop products
==========================================*/
/**
* Redefine product hook
*/
function deadlift_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', 'deadlift_wc_loop_thumbnail', 10, 1 );
add_action( 'woocommerce_after_shop_loop_item', 'deadlift_wc_loop_summary' );
}
add_action( 'woocommerce_init', 'deadlift_remove_loop_item_default_wc_hooks' );
/**
* WC loop thumbnail
*/
function deadlift_wc_loop_thumbnail( $template_args ) {
global $product;
extract(
wp_parse_args(
$template_args,
array(
'display' => '',
)
)
);
$product_thumbnail_size = ( 'metro' === $display ) ? 'deadlift-metro' : 'woocommerce_thumbnail';
$product_thumbnail_size = apply_filters( 'deadlift_' . $display . '_thumbnail_size_name', $product_thumbnail_size );
$product_thumbnail_size = ( deadlift_is_gif( get_post_thumbnail_id() ) ) ? 'full' : $product_thumbnail_size;
?>
<div class="product-thumbnail-container clearfix">
<div class="product-thumbnail-inner">
<a class="entry-link-mask" href="<?php the_permalink(); ?>"></a>
<?php woocommerce_show_product_loop_sale_flash(); ?>
<?php echo woocommerce_get_product_thumbnail( $product_thumbnail_size ); ?>
<?php deadlift_woocommerce_second_product_thumbnail( $product_thumbnail_size ); ?>
<div class="product-actions">
<?php
/**
* Quickview button
*/
do_action( 'deadlift_product_quickview_button', $product );
?>
<?php
/**
* Wishlist button
*/
do_action( 'deadlift_add_to_wishlist_button' );
?>
</div><!-- .product-actions -->
</div><!-- .product-thumbnail-inner -->
</div><!-- .product-thumbnail-container -->
<?php
}
function deadlift_wc_loop_summary() {
?>
<div class="product-summary clearfix">
<div class="product-summary-cell-left">
<?php woocommerce_template_loop_product_link_open(); ?>
<?php woocommerce_template_loop_product_title(); ?>
<?php woocommerce_template_loop_price(); ?>
<?php
/**
* After title
*/
do_action( 'deadlift_after_shop_loop_item_title' );
?>
<?php woocommerce_template_loop_product_link_close(); ?>
</div>
<div class="product-summary-cell-right">
<?php
/**
* Add to cart button
*/
do_action( 'deadlift_product_add_to_cart_button' );
?>
</div>
</div><!-- .product-summary -->
<?php
}
/**
* Quickview product excerpt lenght
*/
add_filter(
'deadlift_show_single_product_wishlist_button',
function() {
return false;
}
);
/**
* Product stacked images + sticky details
*/
function deadlift_single_product_sticky_layout() {
if ( ! deadlift_get_inherit_mod( 'product_sticky' ) || 'no' === deadlift_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 deadlift_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 deadlift_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', 'deadlift' ) );
$html .= '</span>';
echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id );
}
echo '</div>';
}
add_action( 'woocommerce_before_single_product_summary', 'deadlift_single_product_sticky_layout' );
/**
* Add mods
*
* @param array $mods
* @return array $mods
*/
function deadlift_add_mods( $mods ) {
$color_scheme = deadlift_get_color_scheme();
$mods['colors']['options']['secondary_accent_color'] = array(
'id' => 'secondary_accent_color',
'label' => esc_html__( 'Secondary Accent Color', 'deadlift' ),
'type' => 'color',
'transport' => 'postMessage',
'default' => $color_scheme[8],
);
$mods['loading'] = array(
'id' => 'loading',
'title' => esc_html__( 'Loading', 'deadlift' ),
'icon' => 'update',
'options' => array(
array(
'label' => esc_html__( 'Loading Animation Type', 'deadlift' ),
'id' => 'loading_animation_type',
'type' => 'select',
'choices' => array(
'none' => esc_html__( 'None', 'deadlift' ),
'overlay' => esc_html__( 'Overlay', 'deadlift' ),
'deadlift' => esc_html__( 'Overlay with animation', 'deadlift' ),
),
),
),
);
$mods['navigation']['options']['menu_style'] = array(
'id' => 'menu_style',
'label' => esc_html__( 'Main Menu Style', 'deadlift' ),
'type' => 'select',
'choices' => array(
'semi-transparent-white' => esc_html__( 'Semi-transparent White', 'deadlift' ),
'semi-transparent-black' => esc_html__( 'Semi-transparent Black', 'deadlift' ),
'solid' => esc_html__( 'Solid Light', 'deadlift' ),
'solid-dark' => esc_html__( 'Solid Dark', 'deadlift' ),
'transparent' => esc_html__( 'Transparent', 'deadlift' ),
),
'transport' => 'postMessage',
);
$mods['navigation']['options']['side_panel_bg_img'] = array(
'label' => esc_html__( 'Side Panel Background', 'deadlift' ),
'id' => 'side_panel_bg_img',
'type' => 'image',
);
$mods['blog']['options']['post_hero_layout'] = array(
'label' => esc_html__( 'Single Post Header Layout', 'deadlift' ),
'id' => 'post_hero_layout',
'type' => 'select',
'choices' => array(
'' => esc_html__( 'Default', 'deadlift' ),
'standard' => esc_html__( 'Standard', 'deadlift' ),
'big' => esc_html__( 'Big', 'deadlift' ),
'small' => esc_html__( 'Small', 'deadlift' ),
'fullheight' => esc_html__( 'Full Height', 'deadlift' ),
'none' => esc_html__( 'No header', 'deadlift' ),
),
);
if ( isset( $mods['wolf_videos'] ) ) {
$mods['wolf_videos']['options']['video_hero_layout'] = array(
'label' => esc_html__( 'Single Video Header Layout', 'deadlift' ),
'id' => 'video_hero_layout',
'type' => 'select',
'choices' => array(
'' => esc_html__( 'Default', 'deadlift' ),
'standard' => esc_html__( 'Standard', 'deadlift' ),
'big' => esc_html__( 'Big', 'deadlift' ),
'small' => esc_html__( 'Small', 'deadlift' ),
'fullheight' => esc_html__( 'Full Height', 'deadlift' ),
'none' => esc_html__( 'No header', 'deadlift' ),
),
// 'transport' => 'postMessage',
);
$mods['wolf_videos']['options']['video_category_filter'] = array(
'id' => 'video_category_filter',
'label' => esc_html__( 'Category filter (not recommended with a lot of videos)', 'deadlift' ),
'type' => 'checkbox',
);
$mods['wolf_videos']['options']['products_per_page'] = array(
'label' => esc_html__( 'Videos per Page', 'deadlift' ),
'id' => 'videos_per_page',
'type' => 'text',
);
$mods['wolf_videos']['options']['video_pagination'] = array(
'id' => 'video_pagination',
'label' => esc_html__( 'Video Archive Pagination', 'deadlift' ),
'type' => 'select',
'choices' => array(
'standard_pagination' => esc_html__( 'Numeric Pagination', 'deadlift' ),
// 'ajax_pagination' => esc_html__( 'AJAX Pagination', 'deadlift' ),
'load_more' => esc_html__( 'Load More Button', 'deadlift' ),
// 'infinitescroll' => esc_html__( 'Infinite Scroll', 'deadlift' ),
),
// 'transport' => 'postMessage',
);
$mods['wolf_videos']['options']['video_display_elements'] = array(
'id' => 'video_display_elements',
'label' => esc_html__( 'Post meta to show in single video page', 'deadlift' ),
'type' => 'group_checkbox',
'choices' => array(
'show_date' => esc_html__( 'Date', 'deadlift' ),
'show_author' => esc_html__( 'Author', 'deadlift' ),
'show_category' => esc_html__( 'Category', 'deadlift' ),
'show_tags' => esc_html__( 'Tags', 'deadlift' ),
'show_extra_meta' => esc_html__( 'Extra Meta', 'deadlift' ),
),
'description' => esc_html__( 'Note that some options may be ignored depending on the post display.', 'deadlift' ),
);
if ( class_exists( 'Wolf_Custom_Post_Meta' ) ) {
$mods['wolf_videos']['options'][] = array(
'label' => esc_html__( 'Enable Custom Post Meta', 'deadlift' ),
'id' => 'video_enable_custom_post_meta',
'type' => 'group_checkbox',
'choices' => array(
'video_enable_views' => esc_html__( 'Views', 'deadlift' ),
'video_enable_likes' => esc_html__( 'Likes', 'deadlift' ),
),
);
}
}
if ( isset( $mods['portfolio'] ) ) {
$mods['portfolio']['options']['work_hero_layout'] = array(
'label' => esc_html__( 'Single Work Header Layout', 'deadlift' ),
'id' => 'work_hero_layout',
'type' => 'select',
'choices' => array(
'' => esc_html__( 'Default', 'deadlift' ),
'standard' => esc_html__( 'Standard', 'deadlift' ),
'big' => esc_html__( 'Big', 'deadlift' ),
'small' => esc_html__( 'Small', 'deadlift' ),
'fullheight' => esc_html__( 'Full Height', 'deadlift' ),
'none' => esc_html__( 'No header', 'deadlift' ),
),
);
}
if ( isset( $mods['shop'] ) && class_exists( 'WooCommerce' ) ) {
$mods['shop']['options']['product_sticky'] = array(
'label' => esc_html__( 'Stacked Images with Sticky Product Details', 'deadlift' ),
'id' => 'product_sticky',
'type' => 'checkbox',
'description' => esc_html__( 'Not compatible with sidebar layouts.', 'deadlift' ),
);
}
return $mods;
}
add_filter( 'deadlift_customizer_mods', 'deadlift_add_mods', 40 );
/**
* Remove some params
*/
function deadlift_remove_vc_params() {
if ( function_exists( 'vc_remove_element' ) ) {
vc_remove_element( 'wvc_page_index' );
vc_remove_element( 'wvc_interactive_overlays' );
}
if ( function_exists( 'vc_remove_param' ) ) {
// vc_remove_param( 'wvc_product_index', 'product_display' );
vc_remove_param( 'wvc_product_index', 'product_text_align' );
vc_remove_param( 'wvc_interactive_links', '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_team_member', 'layout' );
vc_remove_param( 'wvc_team_member', 'alignment' );
vc_remove_param( 'wvc_team_member', 'v_alignment' );
vc_remove_param( 'wvc_testimonial_slide', 'avatar' );
}
}
add_action( 'init', 'deadlift_remove_vc_params' );
/**
* Set smooth scroll speed
*
* @param string $speed
* @return string $speed
*/
function deadlift_set_smooth_scroll_speed( $speed ) {
return 1400;
}
add_filter( 'deadlift_smooth_scroll_speed', 'deadlift_set_smooth_scroll_speed' );
add_filter( 'wvc_smooth_scroll_speed', 'deadlift_set_smooth_scroll_speed' );
/**
* Set smooth scroll speed
*
* @param string $speed
* @return string $speed
*/
function deadlift_set_fp_anim_time( $speed ) {
return 1000;
}
add_filter( 'wvc_fp_anim_time', 'deadlift_set_fp_anim_time' );
/**
* Add additional JS scripts and functions
*/
function deadlift_enqueue_additional_scripts() {
$version = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? time() : deadlift_get_theme_version();
if ( ! deadlift_is_wolf_extension_activated() ) {
wp_register_style( 'dripicons', get_template_directory_uri() . '/assets/css/lib/fonts/dripicons-v2/dripicons.min.css', array(), deadlift_get_theme_version() );
wp_register_style( 'elegant-icons', get_template_directory_uri() . '/assets/css/lib/fonts/elegant-icons/elegant-icons.min.css', array(), deadlift_get_theme_version() );
wp_register_script( 'countup', get_template_directory_uri() . '/assets/js/lib/countUp.min.js', array(), '1.9.3', true );
}
wp_enqueue_style( 'dripicons' );
wp_enqueue_style( 'font-awesome' );
wp_enqueue_style( 'elegant-icons' );
wp_enqueue_script( 'countup' );
wp_enqueue_script( 'jquery-effects-core' );
wp_enqueue_script( 'deadlift-custom', get_template_directory_uri() . '/assets/js/t/deadlift.js', array( 'jquery' ), $version, true );
}
add_action( 'wp_enqueue_scripts', 'deadlift_enqueue_additional_scripts', 100 );
/**
* Set smooth scroll easing effect
*
* @param string $ease
* @return string $ease
*/
function deadlift_set_smooth_scroll_ease( $ease ) {
return 'easeOutCubic';
}
add_filter( 'deadlift_smooth_scroll_ease', 'deadlift_set_smooth_scroll_ease' );
add_filter( 'wvc_smooth_scroll_ease', 'deadlift_set_smooth_scroll_ease' );
add_filter( 'wvc_fp_easing', 'deadlift_set_smooth_scroll_ease' );
/**
* Add mobile alt body class
*
* @param array
* @return array
*/
function deadlift_additional_body_classes( $classes ) {
$classes[] = 'mobile-menu-alt';
$sticky_details_meta = deadlift_get_inherit_mod( 'product_sticky' ) && 'no' !== deadlift_get_inherit_mod( 'product_sticky' );
$single_product_layout = deadlift_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';
}
return $classes;
}
add_filter( 'body_class', 'deadlift_additional_body_classes' );
/**
* Returns CSS for the color schemes.
*
* @param array $colors Color scheme colors.
* @return string Color scheme CSS.
*/
function deadlift_edit_color_scheme_css( $output, $colors ) {
extract( $colors );
$output = '';
$border_color = sprintf( 'rgba( %s, 0.03)', deadlift_hex_to_rgb( $strong_text_color ) );
$overlay_panel_bg_color = sprintf( 'rgba( %s, 0.95)', deadlift_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{
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;
}
.spinner:before,
.spinner:after{
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{
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{
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;
}
#deadlift-loading-point{
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,
.wolf-share-button-count{
background:$accent_color!important;
}
.entry-post-standard .entry-title a:hover,
.entry-post-masonry .entry-title a:hover,
.entry-post-grid_classic .entry-title a:hover{
color:$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;
}
.nav-menu li.menu-button-primary > a:first-child > .menu-item-inner{
border-color:$accent_color;
background-color:$accent_color;
}
.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-color:$accent_color;
}
.fancybox-thumbs>ul>li:before{
border-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-background-color-accent{
background-color:$accent_color;
}
.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;
}
ul.wc-tabs li.active, ul.wc-tabs li.ui-tabs-active, ul.wc-tabs li:hover, ul.wvc-tabs-menu li.active, ul.wvc-tabs-menu li.ui-tabs-active, ul.wvc-tabs-menu li:hover{
border-top-color: $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-active .wvc-ils-item-title:after,
.wvc-interactive-link-item a:hover .wvc-ils-item-title:after {
color:$accent_color;
}
.wvc-io-active .wvc-io-item-title:after,
.wvc-interactive-overlay-item a:hover .wvc-io-item-title:after {
color:$accent_color;
}
.wolf-twitter-widget a.wolf-tweet-link:hover,
.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{
color:$accent_color!important;
}
.group_table td a:hover{
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,
.cart-icon-product-count{
background:$accent_color;
}
.background-accent,
.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:$accent_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;
}
/* Secondary Text Color */
/* 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 */
.author-box,
input[type=text],
input[type=search],
input[type=tel],
input[type=time],
input[type=url],
input[type=week],
input[type=password],
input[type=checkbox],
input[type=color],
input[type=date],
input[type=datetime],
input[type=datetime-local],
input[type=email],
input[type=month],
input[type=number],
select,
textarea{
border-color:$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-color:$accent_color!important;*/
}
.category-label{
background:$accent_color!important;
}
#back-to-top:hover{
background:$secondary_accent_color!important;
}
.entry-video:hover .video-play-button,
.video-opener:hover{
background-color: $accent_color;
}
.widget.widget_pages ul li a:hover,
.widget.widget_recent_entries ul li a:hover,
.widget.widget_recent_comments ul li a:hover,
.widget.widget_archive ul li a:hover,
.widget.widget_categories ul li a:hover,
.widget.widget_meta ul li a:hover,
.widget.widget_product_categories ul li a:hover,
.widget.widget_nav_menu ul li a:hover,
.wvc-font-dark .widget.widget_pages ul li a:hover,
.wvc-font-dark .widget.widget_recent_entries ul li a:hover,
.wvc-font-dark .widget.widget_recent_comments ul li a:hover,
.wvc-font-dark .widget.widget_archive ul li a:hover,
.wvc-font-dark .widget.widget_categories ul li a:hover,
.wvc-font-dark .widget.widget_meta ul li a:hover,
.wvc-font-dark .widget.widget_product_categories ul li a:hover,
.wvc-font-dark .widget.widget_nav_menu ul li a:hover,
.wvc-font-light .widget.widget_pages ul li a:hover,
.wvc-font-light .widget.widget_recent_entries ul li a:hover,
.wvc-font-light .widget.widget_recent_comments ul li a:hover,
.wvc-font-light .widget.widget_archive ul li a:hover,
.wvc-font-light .widget.widget_categories ul li a:hover,
.wvc-font-light .widget.widget_meta ul li a:hover,
.wvc-font-light .widget.widget_product_categories ul li a:hover,
.wvc-font-light .widget.widget_nav_menu ul li a:hover{
color:$secondary_accent_color!important;
}
.widget.widget_tag_cloud .tagcloud a:hover,
.wvc-font-dark .widget.widget_tag_cloud .tagcloud a:hover,
.wvc-font-light .widget.widget_tag_cloud .tagcloud a:hover{
color:$secondary_accent_color!important;
}
.wvc-breadcrumb 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;
}
.wolf-tweet-link:hover{
color:$accent_color;
}
.wvc-wpe-linked .wvc-wpe-name{
color:$accent_color;
}
.wvc-mi-linked .wvc-mi-name{
color:$accent_color;
}
.wvc-meal-print-button,
.wvc-recipe-print-button,
.wvc-wpe-print-button{
outline-color:$accent_color;
}
.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;
// }
.accent-color-light #back-to-top:hover:after{
color:#333!important;
}
.accent-color-dark #back-to-top:hover:after{
color:#fff!important;
}
.coupon .button:hover{
background:$accent_color!important;
border-color:$accent_color!important;
}
.menu-item-fill{
background:$accent_color!important;
}
.deadlift-button-primary{
background-color:$accent_color;
}
.deadlift-button-secondary{
background-color:$secondary_accent_color;
}
.deadlift-button-special-primary:before{
background-color: $accent_color;
border-color:$accent_color;
}
.deadlift-button-special-primary:after{
background-color:" . $secondary_accent_color . ';
border-color:' . $secondary_accent_color . ";
}
.deadlift-button-special-secondary:before{
background-color: $secondary_accent_color;
border-color:$secondary_accent_color;
}
.deadlift-button-special-secondary:after{
background-color:" . $accent_color . ';
border-color:' . $accent_color . ";
}
.deadlift-button-primary-alt:hover{
background-color:$accent_color;
border-color:$accent_color;
}
.deadlift-button-secondary-alt:hover{
background-color:$secondary_accent_color;
border-color:$secondary_accent_color;
}
button.wvc-mailchimp-submit,
.login-submit #wp-submit,
.single_add_to_cart_button,
.wc-proceed-to-checkout .button,
.woocommerce-form-login .button,
.woocommerce-alert .button,
.woocommerce-message .button{
background:$accent_color;
border-color:$accent_color;
}
.audio-shortcode-container .mejs-container .mejs-controls > .mejs-playpause-button{
background:$accent_color;
}
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
{
background-color:$accent_color!important;
}
.wvc-accordion-tab.ui-state-active{
background-color:$accent_color!important;
}
/* Secondary accent color */
.wvc-text-color-secondary_accent{
color:$secondary_accent_color;
}
.entry-product ins .woocommerce-Price-amount,
.entry-single-product ins .woocommerce-Price-amount{
color:$accent_color;
}
.wolf-tweet-text a,
.wolf ul.wolf-tweet-list li:before,
.wolf-bigtweet-content:before,
.wolf-bigtweet-content a{
color:$accent_color!important;
}
.secondary-accent{
color:$secondary_accent_color;
}
.wvc-background-color-secondary_accent{
background-color:$secondary_accent_color;
}
.wvc-highlight-secondary_accent{
background-color:$secondary_accent_color;
color:#fff;
}
.wvc-icon-background-color-secondary_accent{
box-shadow:0 0 0 0 $secondary_accent_color;
background-color:$secondary_accent_color;
color:$secondary_accent_color;
border-color:$secondary_accent_color;
}
.wvc-icon-background-color-secondary_accent .wvc-icon-background-fill{
box-shadow:0 0 0 0 $secondary_accent_color;
background-color:$secondary_accent_color;
}
.wvc-button-background-color-secondary_accent{
background-color:$secondary_accent_color;
color:$secondary_accent_color;
border-color:$secondary_accent_color;
}
.wvc-button-background-color-secondary_accent .wvc-button-background-fill{
box-shadow:0 0 0 0 $secondary_accent_color;
background-color:$secondary_accent_color;
}
.wvc-svg-icon-color-secondary_accent svg * {
stroke:$secondary_accent_color!important;
}
.wvc-button-color-button-secondary_accent{
background-color: $secondary_accent_color;
border-color: $secondary_accent_color;
}
/* WVC icons */
.wvc-icon-color-secondary_accent{
color:$secondary_accent_color;
}
.wvc-icon-background-color-secondary_accent{
box-shadow:0 0 0 0 $secondary_accent_color;
background-color:$secondary_accent_color;
color:$secondary_accent_color;
border-color:$secondary_accent_color;
}
.wvc-icon-background-color-secondary_accent .wvc-icon-background-fill{
box-shadow:0 0 0 0 $secondary_accent_color;
background-color:$secondary_accent_color;
}
";
$heading_selectors = apply_filters( 'deadlift_heading_selectors', deadlift_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 = deadlift_array_to_list( $heading_selectors );
$output .= "$heading_selectors{text-rendering: auto;}";
// If dark
if ( preg_match( '/dark/', deadlift_get_theme_mod( 'color_scheme' ) ) ) {
$output .= ".wvc-background-color-default.wvc-font-light{
background-color:$page_background_color;
}";
}
// if light
if ( preg_match( '/light/', deadlift_get_theme_mod( 'color_scheme' ) ) ) {
$output .= ".wvc-background-color-default.wvc-font-dark{
background-color:$page_background_color;
}";
}
return $output;
}
add_filter( 'deadlift_color_scheme_output', 'deadlift_edit_color_scheme_css', 10, 2 );
/**
* Vertical bar colors
*/
function deadlift_output_additional_styles() {
$output = '';
/* Content inner background */
$c_ci_bg_color = deadlift_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 = deadlift_get_inherit_mod( 'product_thumbnail_padding' );
if ( $p_t_padding ) {
$p_t_padding = deadlift_sanitize_css_value( $p_t_padding );
$output .= ".entry-product-masonry_overlay_quickview .product-thumbnail-container,
.entry-product-grid_overlay_quickview .product-thumbnail-container,
.wwcq-product-quickview-container .product-images .slide-content img{
padding: $p_t_padding;
}";
}
// $output .= '.sticky-post:before{content: "' . esc_html__( 'Featured', 'deadlift' ) . '";}';
if ( ! SCRIPT_DEBUG ) {
$output = deadlift_compact_css( $output );
}
wp_add_inline_style( 'deadlift-style', $output );
}
add_action( 'wp_enqueue_scripts', 'deadlift_output_additional_styles', 999 );
/**
* Save modal window content after import
*/
function deadlift_set_modal_window_content_after_import() {
$post = deadlift_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', 'deadlift_set_modal_window_content_after_import' );
/**
* Filter lightbox settings
*/
function deadlift_filter_lightbox_settings( $settings ) {
$settings['transitionEffect'] = 'fade';
$settings['buttons'] = array(
'zoom',
// 'share',
'close',
);
return $settings;
}
add_filter( 'deadlift_fancybox_settings', 'deadlift_filter_lightbox_settings' );
/**
* Add label
*/
function deadlift_add_single_product_page_label() {
$output = '';
$label = get_post_meta( get_the_ID(), '_post_product_mp3_label', true );
if ( $label ) {
echo '<span class="single-product-song-label">' . $label . '</span>';
}
echo deadlift_kses( $output );
}
add_action( 'woocommerce_single_product_summary', 'deadlift_add_single_product_page_label', 15 );
/**
* Callback function to filter the MCE settings
*/
function deadlift_mce_before_init_insert_secondary_accent_formats( $style_formats ) {
$style_formats[] = array(
'title' => esc_html__( 'Secondary Accent Color', 'deadlift' ),
'inline' => 'span',
'classes' => 'secondary-accent',
'wrapper' => false,
);
return $style_formats;
}
add_filter( 'deadlift_tiny_mce_style_formats', 'deadlift_mce_before_init_insert_secondary_accent_formats' );