<? 
/**
 * Plugin Name: WaterExperts constumizations
 * Description: Includes speed optimization snippets, as long as the other site-specific functions.
 * Author: Yury Portnov
 * Author URL: https://portnov.agency
 * Version: 1.0.0
 */

define( 'PLUGIN_DIR', dirname( __FILE__ ) );

require_once PLUGIN_DIR . '/actions/index.php';
require_once PLUGIN_DIR . '/assets/index.php';
require_once PLUGIN_DIR . '/shortcodes.php';
require_once PLUGIN_DIR . '/acf.php';
require_once PLUGIN_DIR . '/ajax.php';
require_once PLUGIN_DIR . '/post-types.php';
require_once PLUGIN_DIR . '/disable-comments.php';

/** Water Express specific protected area */
require_once PLUGIN_DIR . '/knowledge-center.php';


add_action( 'wp_enqueue_scripts', function() {
	wp_localize_script( 'legacy', 'bosaq_urls',
		array(
			'ajax_url' => admin_url('admin-ajax.php'),
		)
	);

}, 99 );

// remove cf-7 css
add_action( 'wp_enqueue_scripts', function() {
	wp_dequeue_style( 'contact-form-7' );
});

add_post_type_support( 'page', 'excerpt' );

//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
	if( !is_singular( 'post' ) ):
		wp_dequeue_style( 'wp-block-library' );
		wp_dequeue_style( 'wp-block-library-theme' );
		wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
	endif;
} 
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );

add_action('wp_loaded',function(){
    if( function_exists('oxygen_vsb_register_condition') && function_exists('pll_languages_list') ) {
	
    	$lang_list = pll_languages_list();
    	
    	oxygen_vsb_register_condition(
    		
    		//Condition Name
    		'Locale',
    		
    		//Values
    		array( 
    			'options' => $lang_list,
    			'custom' => false
    		),
    		//Operators
    		array('==', '!='),
    		
    		//Callback Function
    		'polylang_callback',
    		
    		//Condition Category
    		'Polylang'
    	);
    	
    	function polylang_callback($value, $operator) {
    		
    		$my_lang = pll_current_language();
    		global $OxygenConditions;
    		return $OxygenConditions->eval_string($my_lang, $value, $operator);
    	}
    }
    

});


add_action('wp_head',function(){
   ?>
   <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-KQJZTDF');</script>
    <!-- End Google Tag Manager -->
   <?
});

add_action('wp_body_open',function(){
    ?>
    
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KQJZTDF"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->

    <?
});


add_action( 'wp_footer', function(){
	echo '<pre style="display:none">';
		print_r($_SESSION);
	echo '</pre>';
});<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//waterexperts.com/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://waterexperts.com/page-sitemap.xml</loc>
		<lastmod>2026-04-20T21:56:25+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Rank Math SEO Plugin (c) Rank Math - rankmath.com -->