This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).on('scroll.pp-animate', function() { | |
var scrollTop = $(window).scrollTop(), | |
winHeight = $(window).height(), | |
triggerpoint = winHeight * .8 + scrollTop; | |
// If module has animation, otherwise remove .fl-animated class here. | |
$('.animate-post-count.fl-animated .pp-category-count').each(function() { | |
if ( $(this).hasClass( 'revealed' ) ) { | |
return; | |
} | |
var counterElement = $(this).offset().top; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$(document).on('pp_modal_box_rendered', function(e, $scope) { | |
if ( $scope.find( '.woopack-products-grid-wrap' ).length > 0 ) { | |
$scope.find( '.woopack-products-grid-wrap' ).each(function() { | |
var nodeId = $(this).closest('.fl-module').attr('data-node'); | |
if ( 'undefined' !== typeof window['woopack_' + nodeId] ) { | |
var obj = window['woopack_' + nodeId]; | |
if ( ! obj.masonry ) { | |
obj._gridLayoutMatchHeight(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* How to use: [my_custom_timer id="my-timer" time="300" placeholder="00:00"] | |
*/ | |
add_shortcode( 'my_custom_timer', function( $attrs ) { | |
// id attribute for the timer HTML. | |
$id = isset( $attrs['id'] ) && ! empty( $attrs['id'] ) ? $attrs['id'] : 'my-timer'; | |
// set the time to start countdown (in seconds). | |
$time = isset( $attrs['time'] ) && ! empty( $attrs['time'] ) ? intval( $attrs['time'] ) : 120; | |
// default placeholder to appear on load | |
$placeholder = isset( $attrs['placeholder'] ) ? $attrs['placeholder'] : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'pp_post_image_settings_data', function( $data, $settings ) { | |
global $post; | |
if ( false !== strpos( $data['photo_src'], 'placeholder.jpg' ) ) { | |
$terms = get_the_terms( $post->ID, 'category' ); // Here "category" is the post taxonomy slug. | |
if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { | |
$term = $terms[0]; | |
$term_thumb_id = get_term_meta( $term->term_id, 'taxonomy_thumbnail_id', true ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using product_brand taxonomy in this example. | |
add_shortcode( 'product_brand_desc', function() { | |
if ( ! is_single() ) { | |
return; | |
} | |
$current_post_terms = wp_get_post_terms( get_the_ID(), 'product_brand', array( 'fields' => 'ids' ) ); | |
$desc = ''; | |
if ( ! is_wp_error( $current_post_terms ) && ! empty( $current_post_terms ) ) { | |
$current_post_term = $current_post_terms[0]; | |
$desc = get_term_field( 'description', $current_post_term ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode( 'cg_post_featured_image', function( $attrs ) { | |
$args = wp_parse_args( $attrs, array( | |
'linked' => 'yes', | |
) ); | |
$image = get_the_post_thumbnail( $post, $settings->size, array( | |
'itemprop' => 'image', | |
'class' => 'post-featured-image', | |
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.woopack-product-grid { | |
overflow: visible; | |
} | |
.woopack-product-image { | |
position: relative; | |
padding: 0; | |
border: 0; | |
} | |
.woopack-product-image a { | |
display: block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'pp_cg_before_posts', function( $settings, $query ) { | |
if ( 'no' == $settings->post_grid_filters_display || 'none' == $settings->post_grid_filters ) { | |
return; | |
} | |
add_filter( 'pp_cg_filter_terms', function( $terms, $module_settings ) use ( $query ) { | |
$rendered_terms = array(); | |
$posts = $query->get_posts(); | |
foreach ( $posts as $single ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pp-add-to-cart a.loading { | |
opacity: 0.5; | |
pointer-events: none; | |
} | |
.pp-add-to-cart a.added_to_cart { | |
margin-left: 5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Please copy the code below and paste it to your current theme's functions.php | |
add_filter('pp_category_grid_query_args', function($args, $settings) { | |
if ( is_tax() || is_category() || is_tag() ) { | |
$current_object = get_queried_object(); | |
$taxonomy = $current_object->taxonomy; | |
// Unset or remove variables. |