我正在为WP列表中的单listing.php使用自定义模板。
我使用了我自己的主题(由woothemes绘制的画布)一个post模板,并包含了wp-列表代码。http://pastebin.com/cAYFEruA
我遇到的问题是,我的自定义mon-listing.php位于我的子主题目录中。因此,以下代码无法工作,因为文件路径与插件代码不同:
add_action('wp_enqueue_scripts', 'enqueue_single_listing_scripts');
function enqueue_single_listing_scripts() {
wp_enqueue_style( 'wp-listings-single' );
wp_enqueue_style( 'font-awesome' );
wp_enqueue_script( 'jquery-validate', array('jquery'), true, true );
wp_enqueue_script( 'fitvids', array('jquery'), true, true );
wp_enqueue_script( 'wp-listings-single', array('jquery, jquery-ui-tabs', 'jquery-validate'), true, true );
}这些都没有加载到我的自定义模板中。
正确地包含它们的最好方法是什么?
发布于 2014-12-10 18:36:13
请提供适当的路径来登记脚本和样式。
例子-
function theme_name_scripts() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );然后它就能正常工作了
https://wordpress.stackexchange.com/questions/170862
复制相似问题