Skip to content

Instantly share code, notes, and snippets.

@rob-st
rob-st / functions.php
Last active October 20, 2019 03:05
Use jQuery from a CDN in WordPress theme
<?php
function enqueue_jquery_from_cdn() {
/* Step 1: Remove the jQuery included in WP by default.
* Doc: https://codex.wordpress.org/Function_Reference/wp_deregister_script/
*/
wp_deregister_script( 'jquery' );
/* Step 2: Re-add jQuery library with another source.
* Get version source from Google CDN here:
* https://developers.google.com/speed/libraries/#jquery
* Doc: https://developer.wordpress.org/reference/functions/wp_enqueue_script/
@rob-st
rob-st / mage-new-product-top-list.phtml
Last active December 5, 2016 16:08
Magento list view template, keeping newest products on top, sorting the rest by specified backend-order
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php