【发布时间】:2014-12-22 10:04:56
【问题描述】:
我将引导主题转换为 wordpress。现在,我在加载引导脚本和样式时遇到了问题。 这是我在functions.php中的代码
function wpbootstrap_scripts_with_jquery()
{
// Register the script like this for a theme:
wp_register_script( 'custom-script', get_template_directory_uri() . '/js/bootstrap.js', array( 'jquery' ) );
wp_enqueue_script( 'samplejs', get_template_directory_uri() . '/js/jquery.min.js', array( '' ) );
wp_enqueue_script( 'samplejs', get_template_directory_uri() . '/js/clean-blog.min.js', array( '' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
我在标题中添加了这个
<?php wp_enqueue_script("jquery"); ?>
补充问题: wp_register 和 wp_enqueue 有什么区别? 请帮我。我是使用引导程序的初学者。
【问题讨论】:
标签: javascript jquery css wordpress twitter-bootstrap