esc_html( $count_num ) ) ); } add_action( 'wp_ajax_sp_update_wishlist_count', 'beetan_wishlist_ajax_update_count' ); add_action( 'wp_ajax_nopriv_sp_update_wishlist_count', 'beetan_wishlist_ajax_update_count' ); } /** * Add YITH Wishlist supportive scripts */ if ( defined( 'YITH_WCWL' ) && beetan_is_woocommerce_active() ) { function beetan_wishlist_enqueue_custom_script() { wp_add_inline_script( 'jquery-yith-wcwl', " jQuery( function( $ ) { $( document ).on( 'added_to_wishlist removed_from_wishlist', function() { $.get( yith_wcwl_l10n.ajax_url, { action: 'sp_update_wishlist_count' }, function( data ) { $('.wishlist_items_count').hide().text( data.count_num ).fadeIn(500); } ); } ); } ); " ); } add_action( 'wp_enqueue_scripts', 'beetan_wishlist_enqueue_custom_script', 20 ); } if ( ! function_exists( 'beetan_get_template' ) ) { /* * Get Template with Template Argument * * Example: * $attributes = 'attributes'; * $contents = 'contents'; * * beetan_get_template( "template-parts/template-name" ), compact( 'attributes', 'contents' ) ); */ function beetan_get_template( $template_name, $template_args = array(), $include_once = false ) { $path = apply_filters( 'beetan_theme_file_path', get_theme_file_path( $template_name ), $template_name ); do_action( 'beetan_before_get_template', $template_name, $template_args, $path ); extract( $template_args ); if ( $include_once ) { include_once $path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } else { include $path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } do_action( 'beetan_after_get_template', $template_name, $template_args, $path ); } }