function enqueue_javascripts() { wp_register_script("jquery", '//code.jquery.com/jquery-1.10.2.min.js', '', false, true); wp_enqueue_script("jquery"); wp_register_script("colorbox", javascript_url("jquery.colorbox"), '', false, true); wp_enqueue_script("colorbox"); wp_register_script("application", javascript_url("application"), '', false, true); wp_enqueue_script("application"); }
function enqueue_javascripts() { wp_enqueue_script("jquery"); wp_register_script("owl.carousel.min", javascript_url("owl.carousel.min"), '', false, true); wp_enqueue_script("owl.carousel.min"); wp_register_script("TweenMax.min", javascript_url("TweenMax.min"), '', false, true); wp_enqueue_script("TweenMax.min"); wp_register_script("Grid", javascript_url("Grid"), '', false, true); wp_enqueue_script("Grid"); wp_register_script("Multiselect", javascript_url("Multiselect"), '', false, true); wp_enqueue_script("Multiselect"); wp_register_script("Menu", javascript_url("Menu"), '', false, true); wp_enqueue_script("Menu"); wp_register_script("application", javascript_url("application"), '', false, true); wp_enqueue_script("application"); }
function enqueue_javascripts() { wp_enqueue_script("jquery"); wp_register_script("jquery.mousewheel.min", javascript_url("jquery.mousewheel.min"), '', false, true); wp_enqueue_script("jquery.mousewheel.min"); wp_register_script("jquery.hammer.min", javascript_url("jquery.hammer.min"), '', false, true); wp_enqueue_script("jquery.hammer.min"); wp_register_script("jquery.pinchzoomer.min", javascript_url("jquery.pinchzoomer.min"), '', false, true); wp_enqueue_script("jquery.pinchzoomer.min"); wp_register_script("TweenMax.min", javascript_url("TweenMax.min"), '', false, true); wp_enqueue_script("TweenMax.min"); wp_register_script("owl.carousel.min", javascript_url("owl.carousel.min"), '', false, true); wp_enqueue_script("owl.carousel.min"); wp_register_script("modernizr.min", javascript_url("modernizr.min"), '', false, true); wp_enqueue_script("modernizr.min"); wp_register_script("RB/Multiselect", javascript_url("RB/Multiselect"), '', false, true); wp_enqueue_script("RB/Multiselect"); wp_register_script("RB/Grid", javascript_url("RB/Grid"), '', false, true); wp_enqueue_script("RB/Grid"); wp_register_script("RB/Menu", javascript_url("RB/Menu"), '', false, true); wp_enqueue_script("RB/Menu"); wp_register_script("application", javascript_url("application"), '', false, true); wp_enqueue_script("application"); }
/** * Returns an HTML script tag for each of the sources provided as arguments. * Sources may be paths to JavaScript files. Relative paths are assumed to be * relative to assets/javascripts. When passing paths, the ".js" extension is * optional. * If the last argument is an array, it will be used as tag attributes. * * @return @e string * A valid \<script /\> HTML tag. * * @ingroup helperfunc * * @see TagHelper::content_tag() * */ function javascript_include_tag() { $sources = func_get_args(); $attributes = NULL; if (is_array($sources[count($sources) - 1])) { $attributes = array_pop($sources); } $tags = array(); foreach ($sources as $source) { // only http[s] or // (leading double slash to inherit the protocol) // are treated as absolute url if (!is_absolute_url($source)) { $source = javascript_url($source); if (!preg_match("/\\.js\$/", $source)) { $source .= ".js"; } $source = $this->asset_version($source); } $options = array("src" => $source, "type" => "text/javascript"); if (is_array($attributes)) { $options = array_merge($options, $attributes); } $tags[] = content_tag("script", "", $options); } return join("\n", $tags); }
function enqueue_javascripts() { wp_enqueue_script("jquery"); wp_register_script("application", javascript_url("application"), '', false, true); wp_enqueue_script("application"); }
function test_javascript_url() { $this->assertEqual('mocked_stylesheet_directory/assets/javascripts/jquery.js', javascript_url("jquery.js")); }
/** * Returns an HTML script tag for each of the sources provided as arguments. * Sources may be paths to JavaScript files. Relative paths are assumed to be * relative to assets/javascripts. When passing paths, the ".js" extension is * optional. * If the last argument is an array, it will be used as tag attributes. * * @return @e string * A valid \<script /\> HTML tag. * * @ingroup helperfunc * * @see TagHelper::content_tag() * */ function javascript_include_tag() { $sources = func_get_args(); $attributes = NULL; if (is_array($sources[count($sources) - 1])) { $attributes = array_pop($sources); } $tags = array(); foreach ($sources as $source) { if (!preg_match("/^https?:\\/\\//", $source)) { $source = javascript_url($source); if (!preg_match("/\\.js\$/", $source)) { $source .= ".js"; } } $options = array("src" => $source, "type" => "text/javascript"); if (is_array($attributes)) { $options = array_merge($options, $attributes); } $tags[] = content_tag("script", "", $options); } return join("\n", $tags); }