WordPress

WordPress

Enugue Scripts by Chris Coyier

https://css-tricks.com/snippets/wordpress/include-jquery-in-wordpress-theme/
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null); wp_enqueue_script('jquery'); }

Theme Check

Validate your theme.

Unused CSS

Scan your whole site for unused CSS so you can remove them!

Creating custom page templates.

Generate WP Snippets

Create plugins as you develop

Best practice with passive event listeners

This article by Web Dev Guy.
`
(function() {
var supportsPassive = eventListenerOptionsSupported();

if (supportsPassive) {
var addEvent = EventTarget.prototype.addEventListener;
overwriteAddEvent(addEvent);
}

function overwriteAddEvent(superMethod) {
var defaultOptions = {
passive: true,
capture: false
};

EventTarget.prototype.addEventListener = function(type, listener, options) {
  var usesListenerOptions = typeof options === 'object';
  var useCapture = usesListenerOptions ? options.capture : options;

  options = usesListenerOptions ? options : {};
  options.passive = options.passive !== undefined ? options.passive : defaultOptions.passive;
  options.capture = useCapture !== undefined ? useCapture : defaultOptions.capture;

  superMethod.call(this, type, listener, options);
};

}

function eventListenerOptionsSupported() {
var supported = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supported = true;
}
});
window.addEventListener("test", null, opts);
} catch (e) {}

return supported;

}
})();
`

Redirects