站点优化

woodmart主题禁用google组件

禁用google map

在使用wooodmart主题搭配elementor插件进行页面编辑操作的时候,网页会自动加载google map,由于google map访问不到,导致页面加载很慢,所以需要将加载google map的js禁用掉。

经过对woodmart主题的检索,最后发现需要修改的地方。

文件路径:woodmart\inc\enqueue.php

注释第219行、220行代码,示例如下:

if ( woodmart_is_elementor_installed() && ( woodmart_elementor_is_edit_mode() || woodmart_elementor_is_preview_mode() ) ) {
			//wp_enqueue_script( 'wd-google-map-api', 'https://maps.google.com/maps/api/js?libraries=geometry&callback=woodmartThemeModule.googleMapsCallback&v=weekly&key=' . woodmart_get_opt( 'google_map_api_key' ), array( 'woodmart-theme' ), $version, true );
			//wp_enqueue_script( 'wd-maplace', WOODMART_THEME_DIR . '/js/libs/maplace' . $minified . '.js', array( 'wd-google-map-api' ), $version, true );
		}

禁用google字体

文件路径:woodmart/inc/admin/modules/options/controls/typography/class-typography.php

修改第493行代码

public function enqueue() {
	wp_enqueue_script( 'jquery-ui-autocomplete' );
	wp_enqueue_style( 'wp-color-picker' );
	wp_enqueue_script( 'wp-color-picker' );
	wp_enqueue_script( 'wp-color-picker-alpha', WOODMART_ASSETS . '/js/libs/wp-color-picker-alpha.js', array( 'wp-color-picker' ), woodmart_get_theme_info( 'Version' ), true );
	wp_enqueue_script( 'select2' );
	wp_enqueue_script(
		'webfontloader',
		'https://huangbo.cc/wp-content/change/webfont.js',
		array( 'jquery' ),
		'1.5.0',
		true
	);
}