我的主题中的wp\\u enqueue\\u脚本正在主页上运行,而不是在其他页面上运行。
这是我的网站:https://welgo.id.
这里不起作用:https://welgo.id/listing/rs-bandung-eye-center-bandung/
所以在主页上,所有在函数上声明的wp\\u enqueue\\u脚本。php加载所有脚本。但在另一个页面上,只加载了一些脚本。
以下是我的wp\\u enqueue\\u脚本函数:
add_action(\'wp_enqueue_scripts\', \'listingpro_scripts\');
function listingpro_scripts() {
global $listingpro_options;
wp_enqueue_script(\'Mapbox\', THEME_DIR . \'/assets/js/mapbox.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'Mapbox-leaflet\', THEME_DIR . \'/assets/js/leaflet.markercluster.js\', \'jquery\', \'\', true);
//wp_enqueue_script(\'Build\', THEME_DIR . \'/assets/js/build.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'Chosen\',THEME_DIR. \'/assets/lib/chosen/chosen.jquery.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'popper\', THEME_DIR . \'/assets/lib/popper/popper.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'tooltip\', THEME_DIR . \'/assets/lib/popper/tooltip.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'bootstrap\', THEME_DIR . \'/assets/lib/bootstrap/js/bootstrap.min.js\', \'jquery\', \'\', true);
wp_enqueue_script( \'flickity\', THEME_DIR . \'/assets/js/flickity.pkgd.min.js\');
wp_enqueue_script(\'Mmenu\', THEME_DIR . \'/assets/lib/jquerym.menu/js/jquery.mmenu.min.all.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'magnific-popup\', THEME_DIR . \'/assets/lib/Magnific-Popup-master/jquery.magnific-popup.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'select2\', THEME_DIR . \'/assets/js/select2.full.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'popup-classie\', THEME_DIR . \'/assets/lib/popup/js/classie.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'modalEffects\', THEME_DIR. \'/assets/lib/popup/js/modalEffects.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'2checkout\', THEME_DIR. \'/assets/js/2co.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'Owl-Carousel\',THEME_DIR. \'/assets/js/owl.carousel.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'promo-ajax-script\',THEME_DIR. \'/assets/js/tambahan.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'news-ajax-script\',THEME_DIR. \'/assets/js/tambahan.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'jquery-ui\',THEME_DIR . \'/assets/js/jquery-ui.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'Slick\', THEME_DIR . \'/assets/lib/slick/slick.min.js\', \'jquery\', \'\', true);
if(class_exists(\'Redux\')){
$mapAPI = \'\';
$mapAPI = $listingpro_options[\'google_map_api\'];
if(empty($mapAPI)){
$mapAPI = \'AIzaSyDQIbsz2wFeL42Dp9KaL4o4cJKJu4r8Tvg\';
}
wp_enqueue_script(\'mapsjs\', \'https://maps.googleapis.com/maps/api/js?v=3&key=\'.$mapAPI.\'&libraries=places\', \'jquery\', \'\', false);
}
if(!is_front_page()){
wp_enqueue_script(\'pagination\', THEME_DIR . \'/assets/js/pagination.js\', \'jquery\', \'\', true);
}
/* IF ie9 */
wp_enqueue_script(\'html5shim\', \'https://html5shim.googlecode.com/svn/trunk/html5.js\', array(), \'1.0.0\', true);
wp_script_add_data( \'html5shim\', \'conditional\', \'lt IE 9\' );
wp_enqueue_script(\'nicescroll\', THEME_DIR. \'/assets/js/jquery.nicescroll.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'chosen-jquery\', THEME_DIR . \'/assets/js/chosen.jquery.min.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'jquery-ui\',THEME_DIR . \'/assets/js/jquery-ui.js\', \'jquery\', \'\', true);
if(is_page_template( \'template-dashboard.php\' )){
wp_enqueue_script(\'bootstrap-rating\', THEME_DIR . \'/assets/js/bootstrap-rating.js\', \'jquery\', \'\', true);
}
wp_enqueue_script(\'droppin\', THEME_DIR. \'/assets/js/drop-pin.js\', \'jquery\', \'\', true);
if(is_singular(\'listing\')){
wp_enqueue_script(\'singlemap\', THEME_DIR. \'/assets/js/singlepostmap.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'socialshare\', THEME_DIR . \'/assets/js/social-share.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'jquery-prettyPhoto\', THEME_DIR. \'/assets/js/jquery.prettyPhoto.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'bootstrap-rating\', THEME_DIR . \'/assets/js/bootstrap-rating.js\', \'jquery\', \'\', true);
wp_enqueue_script(\'Slick\', THEME_DIR . \'/assets/lib/slick/slick.min.js\', \'jquery\', \'\', true);
}
/* ==============start add by sajid ============ */
global $listingpro_options;
$app_view_home = $listingpro_options[\'app_view_home\'];
$app_view_home = url_to_postid( $app_view_home );
if(is_page( $app_view_home ) || is_tax( \'location\' ) || (is_front_page()) || is_tax( \'listing-category\' ) || is_tax( \'feature\' ) || (
is_search()
&& isset( $_GET[\'post_type\'] )
&& $_GET[\'post_type\'] == \'listing\'
) ){
wp_enqueue_script(\'Slick\', THEME_DIR . \'/assets/lib/slick/slick.min.js\', \'jquery\', \'\', true);
}
/* ==============end add by sajid ============ */
wp_enqueue_script(\'dyn-location-js\', THEME_DIR . \'/assets/js/jquery.city-autocomplete.js\', \'jquery\', \'\', true);
//if(is_archive()){
wp_enqueue_script(\'bootstrapsliderjs\', THEME_DIR . \'/assets/lib/bootstrap/js/bootstrap-slider.js\', \'jquery\', \'\', true);
//}
wp_register_script( \'lp-icons-colors\', THEME_DIR. \'/assets/js/lp-iconcolor.js\' , \'jquery\', \'\', true );
wp_enqueue_script( \'lp-icons-colors\' );
wp_register_script( \'lp-current-loc\', THEME_DIR. \'/assets/js/lp-gps.js\' , \'jquery\', \'\', true );
wp_enqueue_script( \'lp-current-loc\' );
wp_enqueue_script(\'Main\', THEME_DIR. \'/assets/js/main.js\', \'jquery\', \'\', true);
if ( is_singular(\'post\') && comments_open() ) wp_enqueue_script( \'comment-reply\' );
我已经尝试禁用插件,但仍然有一个错误,我的jquery ui。未加载js。
我想知道为什么。我不擅长php和wordpress,所以如果有任何帮助,我将不胜感激。