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
// To Only Retrun the Product Count By Category | |
//[woocommerce_product_category_count category="rings"] | |
// Special thanks to CHADREX | |
add_shortcode( 'products-counter', 'products_counter' ); | |
function products_counter( $atts ) { | |
$atts = shortcode_atts( [ | |
'category' => '', | |
], $atts ); | |
$taxonomy = 'product_cat'; |
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 buddy_exclude_users_by_role( $args ) { | |
// do not exclude in admin. | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
return $args; | |
} | |
$excluded = isset( $args['exclude'] ) ? $args['exclude'] : array(); | |
if ( ! is_array( $excluded ) ) { | |
$excluded = explode( ',', $excluded ); |
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
// hide admin's activities from all activity feeds | |
function ( $a, $activities ) { | |
// ... but allow admin to see his activities! | |
if ( is_super_admin() ) | |
return $activities; | |
foreach ( $activities->activities as $key => $activity ) { | |
// ID's to exclude, separated by commas. ID 1 is always the superadmin | |
if ( $activity->user_id == 1 ) { |
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
<script> | |
const counters = document.querySelectorAll(".count"); | |
const speed = 200; | |
counters.forEach((counter) => { | |
const updateCount = () => { | |
const target = parseInt(+counter.getAttribute("data-target")); | |
const count = parseInt(+counter.innerText); | |
const increment = Math.trunc(target / speed); | |
console.log(increment); |
NewerOlder