| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/old-website/wp-content/plugins/jetpack/3rd-party/ |
Upload File : |
<?php
/**
* This file contains compatibility functions for WooCommerce to improve Jetpack feature support.
*/
add_action( 'woocommerce_init', 'jetpack_woocommerce_integration' );
function jetpack_woocommerce_integration() {
/**
* Double check WooCommerce exists - unlikely to fail due to the hook being used but better safe than sorry.
*/
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
add_action( 'woocommerce_share', 'jetpack_woocommerce_social_share_icons', 10 );
/**
* Wrap in function exists check since this requires WooCommerce 3.3+.
*/
if ( function_exists( 'wc_get_default_products_per_row' ) ) {
add_filter( 'infinite_scroll_render_callbacks', 'jetpack_woocommerce_infinite_scroll_render_callback', 10 );
add_action( 'wp_enqueue_scripts', 'jetpack_woocommerce_infinite_scroll_style', 10 );
}
}
/*
* Make sure the social sharing icons show up under the product's short description
*/
function jetpack_woocommerce_social_share_icons() {
if ( function_exists( 'sharing_display' ) ) {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
echo sharing_display();
}
}
/**
* Remove sharing display from account, cart, and checkout pages in WooCommerce.
*/
function jetpack_woocommerce_remove_share() {
/**
* Double check WooCommerce exists - unlikely to fail due to the hook being used but better safe than sorry.
*/
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
if ( is_cart() || is_checkout() || is_account_page() ) {
remove_filter( 'the_content', 'sharing_display', 19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
}
}
}
add_action( 'loop_start', 'jetpack_woocommerce_remove_share' );
/**
* Add a callback for WooCommerce product rendering in infinite scroll.
*
* @param array $callbacks
* @return array
*/
function jetpack_woocommerce_infinite_scroll_render_callback( $callbacks ) {
$callbacks[] = 'jetpack_woocommerce_infinite_scroll_render';
return $callbacks;
}
/**
* Add a default renderer for WooCommerce products within infinite scroll.
*/
function jetpack_woocommerce_infinite_scroll_render() {
if ( ! is_shop() && ! is_product_taxonomy() && ! is_product_category() && ! is_product_tag() ) {
return;
}
woocommerce_product_loop_start();
while ( have_posts() ) {
the_post();
wc_get_template_part( 'content', 'product' );
}
woocommerce_product_loop_end();
}
/**
* Basic styling when infinite scroll is active only.
*/
function jetpack_woocommerce_infinite_scroll_style() {
$custom_css = "
.infinite-scroll .woocommerce-pagination {
display: none;
}";
wp_add_inline_style( 'woocommerce-layout', $custom_css );
}
function jetpack_woocommerce_lazy_images_compat() {
wp_add_inline_script( 'wc-cart-fragments', "
jQuery( 'body' ).bind( 'wc_fragments_refreshed', function() {
jQuery( 'body' ).trigger( 'jetpack-lazy-images-load' );
} );
" );
}
add_action( 'wp_enqueue_scripts', 'jetpack_woocommerce_lazy_images_compat', 11 );