HEX
Server: nginx/1.18.0
System: Linux vcwordpress 5.15.0-174-generic #184-Ubuntu SMP Fri Mar 13 18:41:50 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vcstore.stgviitor.com/wp-content/themes/buzzstore/functions.php
<?php
/**
 * Buzz Store functions and definitions.
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Buzz_Store
 */

if ( ! function_exists( 'buzzstore_setup' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 */
function buzzstore_setup() {
	/*
	 * Make theme available for translation.
	 * Translations can be filed in the /languages/ directory.
	 * If you're building a theme based on Buzz Store, use a find and replace
	 * to change 'buzzstore' to the name of your theme in all the template files.
	 */
	load_theme_textdomain( 'buzzstore', get_template_directory() . '/languages' );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );

	// WooCommerce Plugins Support
	add_theme_support( 'woocommerce' );

	// Set up the WordPress Gallery Lightbox
	add_theme_support('wc-product-gallery-lightbox');
	
	/*
	 * Let WordPress manage the document title.
	 * By adding theme support, we declare that this theme does not use a
	 * hard-coded <title> tag in the document head, and expect WordPress to
	 * provide it for us.
	 */
	add_theme_support( 'title-tag' );

	/*
	 * Enable support for custom logo.
	*/
	add_theme_support( 'custom-logo', array(
		'width'       => 190,
		'height'      => 60,
		'flex-width'  => true,				
		'flex-height' => true,
		'header-text' => array( '.site-title', '.site-description' ),
	) );

	/*
	 * Enable support for Post Thumbnails on posts and pages.
	 *
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	*/
	add_theme_support( 'post-thumbnails' );
	add_image_size('buzzstore-banner-image', 1350, 485, true); // banner
    add_image_size('buzzstore-news-image', 370, 285, true); // Home Blog
	add_image_size('buzzstore-news-details-image', 850, 385, true); // Details Blog
	add_image_size('buzzstore-cat-image', 275, 370, true);
			

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'topmenu' => esc_html__( 'Top Menu', 'buzzstore' ),
		'primary' => esc_html__( 'Primary', 'buzzstore' ),
	) );

	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'search-form',
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	) );

	// Set up the WordPress core custom background feature.
	add_theme_support( 'custom-background', apply_filters( 'buzzstore_custom_background_args', array(
		'default-color' => 'ffffff',
		'default-image' => '',
	) ) );

	// Indicate widget sidebars can use selective refresh in the Customizer.
	add_theme_support( 'customize-selective-refresh-widgets' );
}
endif; // buzzstore_setup
add_action( 'after_setup_theme', 'buzzstore_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
if ( ! function_exists( 'buzzstore_widgets_init' ) ) {
	function buzzstore_content_width() {
		$GLOBALS['content_width'] = apply_filters( 'buzzstore_content_width', 640 );
	}
	add_action( 'after_setup_theme', 'buzzstore_content_width', 0 );
}
/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
if ( ! function_exists( 'buzzstore_widgets_init' ) ) {
	function buzzstore_widgets_init() {
		//sidebar-1
		register_sidebar( array(
			'name'          => esc_html__( 'Right Sidebar Widget Area', 'buzzstore' ),
			'id'            => 'buzzsidebarone',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title wow fadeInUp" data-wow-delay="0.3s">',			
			'after_title'   => '</h2>',
		) );

		register_sidebar( array(
			'name'          => esc_html__( 'Left Sidebar Widget Area', 'buzzstore' ),
			'id'            => 'buzzsidebartwo',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title wow fadeInUp" data-wow-delay="0.3s">',
			'after_title'   => '</h2>',
		) );

		if ( is_customize_preview() ) {
            $buzzstore_description = sprintf( esc_html__( 'Displays widgets on home page main content area.%1$s Note : Please go to %2$s "Static Front Page"%3$s setting, Select "A static page" then "Front page" and "Posts page" to show added widgets', 'buzzstore' ), '<br />','<b><a class="sparkle-customizer" data-section="static_front_page" style="cursor: pointer">','</a></b>' );
        }
        else{
            $buzzstore_description = esc_html__( 'Displays widgets on Front/Home page. Note : First Create Page and Select "Page Attributes Template"( SpiderMag - FrontPage ) then Please go to Setting => Reading, Select "A static page" then "Front page" and add widgets to show on Home Page', 'buzzstore' );
        }

		register_sidebar( array(
			'name'          => esc_html__( 'Buzz : Home Main Widget Area', 'buzzstore' ),
			'id'            => 'buzzstorehomearea',
			'description'   => $buzzstore_description,
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title wow fadeInUp" data-wow-delay="0.3s">',
			'after_title'   => '</h2>',
		) );

		register_sidebar( array(
			'name'          => esc_html__( 'Footer Widget Area One', 'buzzstore' ),
			'id'            => 'buzzstorefooterone',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		) );

		register_sidebar( array(
			'name'          => esc_html__( 'Footer Widget Area Two', 'buzzstore' ),
			'id'            => 'buzzstorefootertwo',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		) );

		register_sidebar( array(
			'name'          => esc_html__( 'Footer Widget Area Three', 'buzzstore' ),
			'id'            => 'buzzstorefooterthree',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		) );

		register_sidebar( array(
			'name'          => esc_html__( 'Footer Widget Area Four', 'buzzstore' ),
			'id'            => 'buzzstorefooterfour',
			'description'   => esc_html__( 'Add widgets here.', 'buzzstore' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		) );
	}
	add_action( 'widgets_init', 'buzzstore_widgets_init' );
}
/*****************************************************************
** Enqueue scripts and styles.                                  **
******************************************************************/
function buzzstore_scripts() {

		$buzzstore_theme = wp_get_theme();
		$theme_version = $buzzstore_theme->get( 'Version' );

		/* BuzzStore Google Font */
		$buzzstore_font_args = array(
	        'family' => 'Open+Sans:700,600,800,400|Poppins:400,300,500,600,700|Montserrat:400,500,600,700,800',
	    );
	    wp_enqueue_style('buzzstore-google-fonts', add_query_arg( $buzzstore_font_args, "//fonts.googleapis.com/css" ) );
		
	    /* BuzzStore Font Awesome */
	    wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/library/font-awesome/css/font-awesome.min.css', $theme_version );

	    /* BuzzStore Simple Line Icons */
	    wp_enqueue_style( 'simple-line-icons', get_template_directory_uri() . '/assets/library/simple-line-icons/css/simple-line-icons.css', $theme_version );	    
	   
	   	/*BuzzStore Owl Carousel CSS*/
	   	wp_enqueue_style( 'owl-carousel', get_template_directory_uri() . '/assets/library/owlcarousel/css/owl.carousel.css', $theme_version );
	   	wp_enqueue_style( 'owl-theme', get_template_directory_uri() . '/assets/library/owlcarousel/css/owl.theme.css', $theme_version );

	   	/*BuzzStore Bxslider CSS*/
	   	wp_enqueue_style( 'jquery-bxslider', get_template_directory_uri() . '/assets/library/bxslider/css/jquery.bxslider.min.css', $theme_version );

	    /* BuzzStore Main Style */
	    //wp_enqueue_style( 'buzzstore-style', get_stylesheet_uri());
		//wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-style.css'); 
		wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css', array(), rand(111,9999), 'all' );


	    if ( has_header_image() ) {
	    	$custom_css = '.buzz-main-header{ background-image: url("' . esc_url( get_header_image() ) . '"); background-repeat: no-repeat; background-position: center center; background-size: cover; }';
	    	wp_add_inline_style( 'buzzstore-style', $custom_css );
	    }

	    /*BuzzStore Animation */
    	wp_enqueue_style( 'animate', get_template_directory_uri() . '/assets/library/animate/animate.css', $theme_version );
	  	
 		/*BuzzStore Owl Carousel JS*/
 		wp_enqueue_script('owl-carousel-min', get_template_directory_uri() . '/assets/library/owlcarousel/js/owl.carousel.min.js', array('jquery'), $theme_version, true);
 	
 		/*BuzzStore Bxslider*/
 		wp_enqueue_script('jquery-bxslider', get_template_directory_uri() . '/assets/library/bxslider/js/jquery.bxslider.min.js', array('jquery'), '4.2.5', 1);
  	
	    /* BuzzStore html5 */
	    wp_enqueue_script('html5', get_template_directory_uri() . '/assets/library/html5shiv/html5shiv.min.js', array('jquery'), $theme_version, false);
	    wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );

	    /* BuzzStore Respond */
	    wp_enqueue_script('respond', get_template_directory_uri() . '/assets/library/respond/respond.min.js', array('jquery'), $theme_version, false);
	    wp_script_add_data( 'respond', 'conditional', 'lt IE 9' );

    	/*BuzzStore Wow */
    	wp_enqueue_script('wow', get_template_directory_uri() . '/assets/library/wow/js/wow.min.js', array('jquery'), $theme_version, true);
    	
	    /* BuzzStore Jquery Section Start */
	    wp_enqueue_script( 'buzzstore-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), $theme_version, true );

	    wp_enqueue_script( 'buzzstore-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), $theme_version, true );

	    /* BuzzStore Isotope */
	    wp_enqueue_script( 'isotope-pkgd', get_template_directory_uri() . '/assets/library/isotope/js/isotope.pkgd.min.js', array(), $theme_version, true );

	    /* BuzzStore Imagesloaded */
	    wp_enqueue_script( 'imagesloaded' );

	    /* BuzzStore Sidebar Widget Ticker */
    	wp_enqueue_script('theia-sticky-sidebar', get_template_directory_uri() . '/assets/library/theia-sticky-sidebar/js/theia-sticky-sidebar.min.js', array('jquery'), esc_attr( $theme_version ), true);


	    /* BuzzStore SmoothScroll */
	    wp_enqueue_script( 'SmoothScroll', get_template_directory_uri() . '/assets/library/smoothscroll/js/SmoothScroll.min.js', $theme_version, true );
		
	    /* BuzzStore Theme Custom js */
	    wp_enqueue_script('buzzstore-custom', get_template_directory_uri() . '/assets/js/buzzstore-custom.js', array('jquery'), $theme_version, 'ture');

		if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
			wp_enqueue_script( 'comment-reply' );
		}
}
add_action( 'wp_enqueue_scripts', 'buzzstore_scripts' );


/**
 * Admin Enqueue scripts and styles.
*/
if ( ! function_exists( 'buzzstore_media_scripts' ) ) {
    function buzzstore_media_scripts($hook) {

    	if( 'widgets.php' != $hook )
        return;
        wp_register_script('buzzstore-media-uploader', get_template_directory_uri() . '/assets/js/buzzstore-admin.js', array('jquery','customize-controls') );
        wp_enqueue_script('buzzstore-media-uploader');
        wp_localize_script('buzzstore-media-uploader', 'buzzstore_widget_img', array(
            'upload' => esc_html__('Upload', 'buzzstore'),
            'remove' => esc_html__('Remove', 'buzzstore')
        ));
        wp_enqueue_style( 'buzzstore-admin-style', get_template_directory_uri() . '/assets/css/buzzstore-admin.css');    
    }
}
add_action('admin_enqueue_scripts', 'buzzstore_media_scripts');


/**
 * Require init.
*/
require  trailingslashit( get_template_directory() ).'sparklethemes/init.php';


function buzzstore_pingback_header() {
	if ( is_singular() && pings_open() ) {
		printf( '<link rel="pingback" href="%s">' . "\n", get_bloginfo( 'pingback_url' ) );
	}
 }
 add_action( 'wp_head', 'buzzstore_pingback_header' );
 

if ( isset( $wp_customize->selective_refresh ) ) {

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title',
		'container_inclusive' => false,
		'render_callback' => 'buzzstore_customize_partial_blogname',
	) );

	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'container_inclusive' => false,
		'render_callback' => 'buzzstore_customize_partial_blogdescription',
	) );

	
	$wp_customize->selective_refresh->add_partial( 'buzzstore_header_leftside_options', array(
		'selector' => '.buzz-topleft',
		'container_inclusive' => false,
	) );

	$wp_customize->selective_refresh->add_partial( 'buzzstore_social_facebook', array(
		'selector' => '.buzz-socila-link',
		'container_inclusive' => false,
	) );

	$wp_customize->selective_refresh->add_partial( 'paymentlogo_image_two', array(
		'selector' => '.footer-payments',
		'container_inclusive' => false,
	) );

	$wp_customize->selective_refresh->add_partial( 'buzzstore_search_options', array(
		'selector' => '.header-search',
		'container_inclusive' => false,
	) );

	$wp_customize->selective_refresh->add_partial( 'buzzstore_display_wishlist', array(
		'selector' => '.buzz-topright',
		'container_inclusive' => false,
	) );

	$wp_customize->selective_refresh->add_partial( 'buzzstore_icon_block_section', array(
		'selector' => '.buzz-services',
		'container_inclusive' => false,
	) );	
			
	$wp_customize->selective_refresh->add_partial( 'buzzstore_woocommerce_enable_disable_section', array(
		'selector' => '.breadcrumbswrap',
		'container_inclusive' => false,
	) );
	
	$wp_customize->selective_refresh->add_partial( 'buzzstore_footer_buttom_copyright_setting', array(
		'selector' => '.footer_copyright',
		'container_inclusive' => false,
	) );

}

function buzzstore_customize_partial_blogname() {
	bloginfo( 'name' );
}
function buzzstore_customize_partial_blogdescription() {
	bloginfo( 'description' );
}
/* Remove checkout fields */

add_filter( 'woocommerce_checkout_fields', 'misha_remove_fields', 9999 );
 
function misha_remove_fields( $woo_checkout_fields_array ) {
 
	// she wanted me to leave these fields in checkout
	// unset( $woo_checkout_fields_array['billing']['billing_first_name'] );
	// unset( $woo_checkout_fields_array['billing']['billing_last_name'] );
	// unset( $woo_checkout_fields_array['billing']['billing_phone'] );
	// unset( $woo_checkout_fields_array['billing']['billing_email'] );
	// unset( $woo_checkout_fields_array['order']['order_comments'] ); // remove order notes
 
	// and to remove the billing fields below
	//unset( $woo_checkout_fields_array['billing']['billing_first_name'] ); // remove company field
	//unset( $woo_checkout_fields_array['billing']['billing_last_name'] ); // remove company field
	$woo_checkout_fields_array['billing']['billing_phone']['required'] = false;
	unset( $woo_checkout_fields_array['billing']['billing_phone'] ); // remove company field
	//unset( $woo_checkout_fields_array['billing']['billing_email'] ); // remove company field
	unset( $woo_checkout_fields_array['billing']['billing_company'] ); // remove company field
	unset( $woo_checkout_fields_array['billing']['billing_country'] );
	$woo_checkout_fields_array['billing']['billing_address_1']['required'] = false;
	unset( $woo_checkout_fields_array['billing']['billing_address_1'] );
	$woo_checkout_fields_array['billing']['billing_address_2']['required'] = false;
	unset( $woo_checkout_fields_array['billing']['billing_address_2'] );
	$woo_checkout_fields_array['billing']['billing_city']['required'] = false;
	unset( $woo_checkout_fields_array['billing']['billing_city'] );
	unset( $woo_checkout_fields_array['billing']['billing_state'] ); // remove state field
	unset( $woo_checkout_fields_array['billing']['billing_postcode'] ); // remove zip code field
 
	unset($woo_checkout_fields_array['shipping']['shipping_first_name']);    
    unset($woo_checkout_fields_array['shipping']['shipping_last_name']);  
    unset($woo_checkout_fields_array['shipping']['shipping_company']);
    unset($woo_checkout_fields_array['shipping']['shipping_address_1']);
    unset($woo_checkout_fields_array['shipping']['shipping_address_2']);
    unset($woo_checkout_fields_array['shipping']['shipping_city']);
    unset($woo_checkout_fields_array['shipping']['shipping_postcode']);
    unset($woo_checkout_fields_array['shipping']['shipping_country']);
    unset($woo_checkout_fields_array['shipping']['shipping_state']);
    
    // remove order comment fields
unset($woo_checkout_fields_array['order']['order_comments']);
	return $woo_checkout_fields_array;
}
/*
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
    function wcs_woo_remove_reviews_tab($tabs) {
    unset($tabs['reviews']);
    return $tabs;
} */
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

add_filter('woocommerce_sale_flash', 'vs_change_sale_content', 10, 3);
function vs_change_sale_content($content, $post, $product){
   $content = '<span class="onsale">'.__( 'Pro', 'woocommerce' ).'</span>';
   return $content;
}
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
 
function woo_custom_add_to_cart( $cart_item_data ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
 
return $cart_item_data;
}
/**
* Remove Product Links in WooCommerce Order Emails
*/
add_filter('woocommerce_order_item_name', 'woocommerce_order_item_link', 10, 3);

function woocommerce_order_item_link( $item_name, $item, $bool ) {
    $url = get_permalink( $item['product_id'] ) ;
    return $item_name; 
}
add_filter( 'woocommerce_order_item_permalink', '__return_false' );
add_filter( 'woocommerce_order_item_name', 'remove_permalink_order_table', 10, 3 );
 
function remove_permalink_order_table( $name, $item, $order ) {
   $name = $item['name'];
   return $name;
}
/*
** auto complete order status
*/
add_action( 'woocommerce_order_status_processing', 'processing_to_completed');
function processing_to_completed($order_id){

 

    $order = new WC_Order($order_id);
    $order->update_status('completed'); 

 

}

function vc_mime_types( $mimes ) {
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}
add_filter( 'upload_mimes', 'vc_mime_types' );