1
我有多個模板的條件加入到這個代碼:如何將多個模板添加到if_page_template中?
if (is_page_template('single.php')) {
wp_enqueue_script('google-maps-infobox', get_template_directory_uri() . '/js/gmap3.infobox.js', array('jquery'), '225', true);
wp_enqueue_script('google-maps-infobox2', get_template_directory_uri() . '/js/gmap3.infobox2.js', array('jquery'), '225', true);
}
正如你看到的我已經添加的single.php,但它需要在這裏添加template1.php,template2.php等。我試過這樣:
if (is_page_template('single.php', 'template1.php', 'template2.php')) {
wp_enqueue_script('google-maps-infobox', get_template_directory_uri() . '/js/gmap3.infobox.js', array('jquery'), '225', true);
wp_enqueue_script('google-maps-infobox2', get_template_directory_uri() . '/js/gmap3.infobox2.js', array('jquery'), '225', true);
}
不幸的是,這並沒有奏效。如何編輯這個使用這些模板爲WordPress頁面排列多個腳本?
問候
謝謝,它幫助了我很多! – twelvell