Skip to content

Instantly share code, notes, and snippets.

View Filtering enqueued WordPress script to add async, etc
/**
* NOTE: code from http://scottnelle.com/756/async-defer-enqueued-wordpress-scripts/
* Add async attributes to enqueued scripts where needed.
* The ability to filter script tags was added in WordPress 4.1 for this purpose.
*/
function my_async_scripts( $tag, $handle, $src ) {
// the handles of the enqueued scripts we want to async
$async_scripts = array( 'some-script', 'another-script' );
if ( in_array( $handle, $async_scripts ) ) {
View gist:dcf0563f20031040962ce6add3a886b5
<?php
wc_dropdown_variation_attribute_options( array(
'options' => $options,
//'attribute' => $attribute_name,
'product' => $product,
) );
@rickgregory
rickgregory / functions.php
Created Feb 22, 2018 — forked from yratof/functions.php
ACF OEmbed with thumbnails
View functions.php
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
View the_slug function
function the_slug() {
$post_data = get_post($post->ID, ARRAY_A);
$slug = $post_data['post_name'];
return $slug; }
View category.php
<?php shopp('collection.description'); ?>
<?php if ( shopp( 'collection.hasproducts' ) ) : ?>
<div class="category">
<?php shopp( 'storefront.breadcrumb', array( 'separator' => '&nbsp;&raquo; ' ) ); ?>
<ul class="products">
<?php while( shopp( 'collection.products' ) ) : ?>
<li class="product<?php if ( shopp('collection.row') ) echo ' first'; ?>" itemscope itemtype="http://schema.org/Product">
@rickgregory
rickgregory / blockerList.json
Last active Sep 1, 2015
Testing Safari Content Blocker on iMore.com
View blockerList.json
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"load-type": ["third-party"],
"if-domain": ["*imore.com"]
@rickgregory
rickgregory / 0_reuse_code.js
Created Dec 23, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.