Skip to content

Adding Script Dependencies

Jim Reevior edited this page Aug 14, 2018 · 1 revision

Adding Script Dependencies

The main JavaScript file for a Responsive Framework theme will always be loaded automatically by the framework. If there are scripts that must be loaded before this script (jQuery libraries, for example), they can be added as dependencies.

<?php
/**
 * Add Waypoints as a dependency for the theme's JavaScript.
 *
 * @param array $dependencies Responsive script dependencies.
 *
 * @return array Responsive script dependencies.
 */
function mytheme_r_script_dependencies( $dependencies ) {
	$dependencies[] = 'waypoints';

	return $dependencies
}
add_filter( 'r_script_dependencies', 'mytheme_r_script_dependencies' );

Note: You need to enqueue the scripts yourself in the wp_enqueue_scripts action hook.

Welcome to Responsive!

Get started

Configuration

Build child themes

Sass

Javascript

PHP

Shortcodes

Templates

GitHub

Tasks

Contribute to the framework

Code Examples

BU Developer Resources

Clone this wiki locally