Skip to content

Instantly share code, notes, and snippets.

<?php
/* Add the color CSS to the header */
add_action('wp_head', 'region_head_css');
function region_head_css() {
echo '<style type="text/css">#selector { rule: value; }</style>';
}
@jstnkrr
jstnkrr / region_script.php
Last active April 8, 2016 20:44
region_enqueue_scripts
<?php
// Load JS for this page, with dependencies
add_action('wp_enqueue_scripts', 'region_enqueue_scripts');
function region_enqueue_scripts() {
wp_enqueue_script('region-template-name', get_template_directory_uri() . '/_/js/regions/template-name.js', array('jquery'), null, true);
}
@jstnkrr
jstnkrr / hero_products_home
Last active December 14, 2015 20:25
Terrafolia hero snippet
<!--
Tweak styles here
-->
<style>
#home-hero {
background: url('{{media url="wysiwyg/infortis/ultimo/slideshow/backer5.jpg"}}') no-repeat;
background-size:cover;
height:460px;
}
#home-hero-products {
@jstnkrr
jstnkrr / tel-links.js
Created October 22, 2015 20:53
Trigger GA Event for Telephone Links
@jstnkrr
jstnkrr / form-handler.js
Last active October 22, 2015 20:51
Trigger GA event for Gravity Forms AJAX Confirmations
jQuery(document).on('gform_confirmation_loaded', function(event, formId){
ga('send', 'event', 'Form Name', 'Submit', 'Button Name', 25);
});
@jstnkrr
jstnkrr / awsbackup.sh
Last active February 10, 2018 19:42
S3 backup for ServerPilot
#!/bin/bash
export BUCKET=filament-sp-backup
date_daily=`date +"%Y-%m-%d"`
tmp_dir=/tmp/sp-backup-$date_daily
# Get current month and week day number
month_day=`date +"%d"`
week_day=`date +"%u"`
@jstnkrr
jstnkrr / region_body_class.php
Last active April 8, 2016 20:48
region_body_class
<?php
// add a custom body class to a Wordpress template
// place this at the top of the template file before output
add_filter('body_class', 'region_body_class');
function region_body_class($classes) {
$classes[] = 'template-body-class';
return $classes;
@jstnkrr
jstnkrr / clean-thumbs.php
Created December 3, 2014 00:33
Script to clean WP content upload folder of resized images
<?php
$Directory = new RecursiveDirectoryIterator('../legacy/wp-content/uploads/');
$Iterator = new RecursiveIteratorIterator($Directory);
$i = 0;
foreach($Iterator as $name => $object){
if (!preg_match('/[\_\-]\d+x\d+\./i', $name)) continue;
//if ($i > 20) break;
@jstnkrr
jstnkrr / DoctrineExport.grt.lua
Last active July 20, 2017 18:52
Doctrine 1 ORM exporter for MySQL Workbench (place in modules folder)
--
-- MySQL Workbench Doctrine Export Plugin
-- Version: 0.4.1
-- Authors: Johannes Mueller, Karsten Wutzke
-- Copyright (c) 2008-2009
--
-- http://code.google.com/p/mysql-workbench-doctrine-plugin/
--
-- * The export plugin allows you to export a catalog as Doctrine YAML schema.
-- * This plugin was tested with MySQL Workbench 5.1.18a (JM) and 5.2.4a (KW)