-
Notifications
You must be signed in to change notification settings - Fork 0
Loading a Custom Build of Modernizr
Responsive Framework comes with a build of Modernizr that will be sufficient for most sites. If a site requires additional (or less) Modernizr checks, it is possible to load a custom build of Modernizr.
Before loading a custom Modernizr build, think of this question. Would this reasonably benefit every site using Responsive Framework? If the answer is yes, then a pull request should be opened on Responsive Framework instead of using the following approach.
<?php
/**
* Set the Modernizr version constant to our custom build version.
*/
define( 'RESPONSIVE_MODERNIZR_VERSION', '3.5.1' );
/**
* Prevent Responsive Framework from enqueueing the version of Modernizr it ships with.
*/
add_filter( 'r_enqueue_modernizr', '__return_false' );
/**
* Load a custom build of Modernizr.
*/
function mytheme_enqueue_scripts() {
wp_enqueue_script( 'modernizr', get_stylesheet_directory_uri() . "/path/to/modernizr.min.js", array(), RESPONSIVE_MODERNIZR_VERSION );
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_scripts' );
To ensure that Modernizr is loaded before responsive-scripts
(the framework's
primary JavaScript file), modernizr
also needs to be re-added as a
dependency.
<?php
/**
* Add Modernizr as a dependency of `responsive-scripts`.
*/
function mytheme_r_script_dependencies( $dependencies ) {
$dependencies[] = '';
return $dependencies;
}
add_action( 'r_script_dependencies', 'mytheme_r_script_dependencies' );
Get started
Configuration
Build child themes
- Customizing CSS in a child theme
- Overriding templates in a child theme
- Code patterns
- Code reviews
- Pulling in Foundation Updates
- Merging and Creating a Pull Request
Sass
Javascript
PHP
- Coding Standards
- PHP Constants
- Temp PHP Code Patterns
- PHP Snippets
- How to Use Hooks
- Action Hooks
- Using Action Hooks To Output Markup
- Filter Hooks
Shortcodes
Templates
GitHub
Tasks
Contribute to the framework
- Framework Development and Release Workflows
- Documentation Template
- Testing your changes
- Creating a new release
- Migration Guide
- Needs Documentation
Code Examples
- Adding Content Container Classes
- Adding News Templates
- Adding Script Dependencies
- Changing Available Layouts and Default Layout
- Displaying a Fancy Gallery
- Loading a Custom Build of Modernizr
- Loading Modernizr in the Footer
- Using Action Hooks To Output Markup
- Understanding get_template_part
BU Developer Resources