NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| <?php | |
| add_action( 'init', 'gs_books_label_rename', 999 ); | |
| /** | |
| * Modify registered post type menu label | |
| * | |
| */ | |
| function gs_books_label_rename() { | |
| global $wp_post_types; | |
| $wp_post_types['gs_books']->labels->menu_name = __( 'Books', 'gs_books' ); |
| define(function (require) { | |
| var module; | |
| // Setup temporary Google Analytics objects. | |
| window.GoogleAnalyticsObject = "ga"; | |
| window.ga = function () { (window.ga.q = window.ga.q || []).push(arguments); }; | |
| window.ga.l = 1 * new Date(); | |
| // Immediately add a pageview event to the queue. |
| // Support routines for automatically reporting user timing for common analytics platforms | |
| // Currently supports Google Analytics, Boomerang and SOASTA mPulse | |
| // In the case of boomerang, you will need to map the event names you want reported | |
| // to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable: | |
| // rumMapping = {'aft': 'custom0'}; | |
| (function() { | |
| var wtt = function(n, t, b) { | |
| t = Math.round(t); | |
| if (t >= 0 && t < 3600000) { | |
| // Google Analytics |
| function run(generator) { | |
| var iterator = generator(resume); | |
| var data = null, yielded = false; | |
| iterator.next(); | |
| yielded = true; | |
| check(); | |
| function check() { | |
| while (data && yielded) { |
| (function(doc) { | |
| // Add touch device support for dropdown menu | |
| if (('addEventListener' in doc) && ('querySelectorAll' in doc) && (('ontouchstart' in window) || ('onmsgesturechange' in window))) { | |
| var menu_item_selector = '.the-menu > div > ul > li', | |
| menu_items = doc.querySelectorAll(menu_item_selector), | |
| touchStart; | |
| // Set up touch start handler | |
| touchStart = function() { | |
| if (this.className.indexOf(' tapped') > -1) { |
| (function(){ | |
| var key = localStorage.wpt_key; | |
| if (!key) { | |
| var prompt = window.__proto__.prompt; | |
| key = prompt('Your WebPagetest API key, please?'); | |
| if (!key) { | |
| return gameOver(); | |
| } | |
| localStorage.wpt_key = key; |
| // Straightforward + simple. | |
| $("button").on("click", function(event) { | |
| event.preventDefault(); | |
| var button = $(this); | |
| var numberElem = button.find(".number"); | |
| var number = Number(numberElem.text()) - 1; | |
| numberElem.text(number); | |
| if (number === 0) { | |
| button.prop("disabled", true); | |
| button.off("click"); |
| // addEventListener polyfill IE6+ | |
| !window.addEventListener && (function (window, document) { | |
| function Event(e, element) { | |
| var instance = this; | |
| for (property in e) { | |
| instance[property] = e[property]; | |
| } | |
| instance.currentTarget = element; |
| document.body.addEventListener('error', function(event) { | |
| if ( event.target.nodeName.toLowerCase() == 'img' ) { | |
| // an image on the page failed to load | |
| } | |
| }, true); |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name