Created
December 3, 2018 13:35
-
-
Save NicktheGeek/8ebc8bf3a36c8e7780d79e2b96365273 to your computer and use it in GitHub Desktop.
Add tota11y to WP Theme using WP_DEBUG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Theme functions.php file. | |
* | |
* This file adds functions to the {theme}. | |
* | |
* @package nls | |
* @author NicktheGeek | |
* @license GPL-2.0+ | |
* @link http://designsbynickthegeek.com/ | |
*/ | |
// Any code required to setup the theme like calling parent theme functions.php file in Genesis. | |
/** | |
* Enqueue Scripts and Styles. | |
*/ | |
public function theme_prefix_enqueue_scripts() { | |
// This checks to see if WP_DEBUG is defined and is true before enqueueing the script. | |
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) { | |
/** | |
* Copy tota11y.min.js from the latest release at: | |
* https://github.com/Khan/tota11y/ | |
* | |
* It goes in the {theme}/assets/js/ folder, | |
* or edit the enqueue directory to match the theme JS folder location. | |
* | |
* I'm not sure it requires jQuery. The docs mention jQuery though, so I include it as required just to be sure. | |
*/ | |
wp_enqueue_script( 'nls-a11y-testing', get_stylesheet_directory_uri() . '/assets/js/tota11y.min.js', [ 'jquery' ], '1.0', true ); | |
} | |
// Add any other scripts and styles the theme needs to enqueue. | |
} | |
add_action( 'wp_enqueue_scripts', 'theme_prefix_enqueue_scripts' ); | |
// Whatever else goes in your theme functions.php file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment