Skip to content

Instantly share code, notes, and snippets.

<?php
function my_css_function() {
if ( is_single() && get_post_meta( get_the_ID(), 'field_key', true ) != '' ) {
wp_enqueue_style( 'style-name', 'folder/stylesheet.css' );
}
}
add_action( 'wp_enqueue_scripts', 'my_css_function' );
<?php
/*
Plugin Name: Find Video Thumbnails in Post and Custom Field
Plugin URI: http://refactored.co
Description: Mod for Video Thumbnails to also scan the post content when a custom field is entered in the settings.
Author: Refactored Co.
Author URI: http://refactored.co
Version: 0.1
License: GPL2
<?php
/*
Plugin Name: Video Importer Temporary Drafts
Plugin URI: https://refactored.co
Description: Temporarily saves imported posts as a draft so any publishing logic doesn't run until custom fields are saved
Version: 1.0
Author: Refactored Co.
Author URI: https://refactored.co
*/
@suth
suth / gist:2640615
Created May 9, 2012 00:10
Facebook Thumbnail Class
class Facebook_Thumbnails extends Video_Thumbnails_Providers {
// Regex strings
public $regexes = array(
'#"http://www.facebook.com/v/([0-9]+)"#' // Facebook Embed
);
// Thumbnail URL
public function get_thumbnail_url( $id ) {
return 'https://graph.facebook.com/' . $id . '/picture';
@suth
suth / gist:2895907
Created June 8, 2012 14:30
Quick WordPress Instance
#! /bin/bash
clear
echo "WordPress Instance Setup"
echo "========================"
echo
echo "Enter a domain for your site"
read domain
<?php
/*
Plugin Name: Extend HTTP Request Timeout
Plugin URI: https://refactored.co
Description: Extends the default timeout length for the WordPress HTTP API
Author: Sutherland Boswell
Author URI: http://sutherlandboswell.com
Version: 1.0
License: GPL2
*/
@suth
suth / sortable.js
Created January 26, 2017 06:19
Vue.js 2.0 Sortable Directive
import Vue from 'vue'
import Sortable from 'sortablejs'
Vue.directive('sortable', {
inserted: function (el, binding, vnode) {
var sortable = new Sortable(el, binding.value || {});
if (binding.arg) {
if (!vnode.context.sortable) {
vnode.context.sortable = {}