Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@agusmu
agusmu / functions.php
Last active December 19, 2015 17:38 — forked from jameskoster/functions.php
Woocommerce - Change Denmark currency from kr to DKK
add_filter('woocommerce_currency_symbol', 'change_denmark_existing_currency_symbol', 10, 2);
function change_denmark_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'DKK' : $currency_symbol = 'DKK'; break;
}
return $currency_symbol;
}
<?php
/**
* Plugin installation and activation for WordPress themes.
*
* @package TGM-Plugin-Activation
* @version 2.3.6
* @author Thomas Griffin <thomas@thomasgriffinmedia.com>
* @author Gary Jones <gamajo@gamajo.com>
* @copyright Copyright (c) 2012, Thomas Griffin
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
<?php
define( 'THEMENAME', 'Kallyas' );
require_once dirname( __FILE__ ) . '/framework/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'kallyas_register_required_plugins' );
function kallyas_register_required_plugins() {
/**
<?php
/*
Plugin Name: Soliloquy Demo
Plugin URI: http://soliloquywp.com/
Description: Creates demo user and manages roles so Soliloquy can have a live demo.
Author: Thomas Griffin
Author URI: http://thomasgriffinmedia.com/
Version: 1.0.0
License: GNU General Public License v2.0 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
<?php
/**
* Database emtpying and file removing class.
*
* Truncates all necessary tables in the defined database and removes
* any files uploaded by the demo user.
*
* @since 1.0.0
*
* @author Thomas Griffin
/*
* Supposition v0.3a - an optional enhancer for Superfish jQuery menu widget
*
* Copyright (c) 2013 Joel Birch - based on work by Jesse Klaasse - credit goes largely to him.
* Special thanks to Karl Swedberg for valuable input.
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@agusmu
agusmu / 0_reuse_code.js
Created December 23, 2013 04:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console