【发布时间】:2016-06-22 19:34:19
【问题描述】:
我正在从我构建的静态站点创建我的第一个 wordpress 主题,该站点在 CDN 提供的 Boostrap 上运行。
请不要建议下载此项目的 boostrap,它需要通过 CDN 交付。
我想使用我的functions.php文件通过CDN加载boostrap,但不是加载它,而是在加载页面的顶部显示文本(检查面板中没有明显的内容,也没有错误消息它只是出现将functions.php中的信息显示为文本)。
我在 header.php 中包含了<?php wp_head(); ?>
functions.php 中的所有代码:
function my_scripts_enqueue() {
wp_register_script( 'bootstrap-js', '://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js', array('jquery'), NULL, true );
wp_register_script( 'gajax-js', '://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js', array('jquery'), NULL, true );
wp_register_style( 'bootstrap-css', '://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css', false, NULL, 'all' );
wp_register_style( 'fontawsome-css', '://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', false, NULL, 'all' );
wp_enqueue_script( 'bootstrap-js' );
wp_enqueue_script( 'gajax-js' );
wp_enqueue_style( 'bootstrap-css' );
wp_enqueue_style( 'fontawsome-css' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_enqueue' );
【问题讨论】:
标签: php wordpress twitter-bootstrap-3 cdn