Skip to content

Instantly share code, notes, and snippets.

View thetrickster's full-sized avatar

Chris Matthias thetrickster

View GitHub Profile

Keybase proof

I hereby claim:

  • I am thetrickster on github.
  • I am chrismatthias (https://keybase.io/chrismatthias) on keybase.
  • I have a public key ASBPQ6BDJD22nM34MBpZVmlF8-lQ0b-OO4m6z7dWLKRX2Ao

To claim this, I am signing this object:

@thetrickster
thetrickster / contact-form-7-slug-validation.php
Last active January 10, 2016 03:09
Slug Validation for Contact Form 7
<?php
function cf7_slug_validation($result,$tag) {
$type = $tag['type'];
$name = $tag['name'];
if($type == 'text*' && $_POST[$name] == ''){
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
@thetrickster
thetrickster / cf7-custom-validations.md
Last active August 29, 2015 14:18
Contact Form 7 4.1 Custom Validations Fix/Error
@thetrickster
thetrickster / cf7-us-state-dropdown-code.txt
Last active August 29, 2015 14:05
Contact Form 7 (CF7) US State Dropdown with piping-- Shows full State name to user but passes only state abbreviation to form. Allows for more accurate state capture by removing abbreviations for frontend user and using select removes typos.
[select state include_blank "Alabama|AL" "Alaska|AK" "Arizona|AZ" "Arkansas|AR" "California|CA" "Colorado|CO" "Connecticut|CT" "Delaware|DE" "Florida|FL" "Georgia|GA" "Hawaii|HI" "Idaho|ID" "Illinois|IL" "Indiana|IN" "Iowa|IA" "Kansas|KS" "Kentucky|KY" "Louisiana|LA" "Maine|ME" "Maryland|MD" "Massachusetts|MA" "Michigan|MI" "Minnesota|MN" "Mississippi|MS" "Missouri|MO" "Montana|MT" "Nebraska|NE" "Nevada|NV" "New Hampshire|NH" "New Jersey|NJ" "New Mexico|NM" "New York|NY" "North Carolina|NC" "North Dakota|ND" "Ohio|OH" "Oklahoma|OK" "Oregon|OR" "Pennsylvania|PA" "Rhode Island|RI" "South Carolina|SC" "South Dakota|SD" "Tennessee|TN" "Texas|TX" "Utah|UT" "Vermont|VT" "Virginia|VA" "Washington|WA" "West Virginia|WV" "Wisconsin|WI" "Wyoming|WY"]
function xf_insert_image( $html, $id, $caption, $title, $align, $url )
{
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption>$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}
@thetrickster
thetrickster / Remove Open Sans from Wordpress 3.8 .md
Last active March 8, 2022 12:26
Remove Open Sans from Wordpress >= 3.8 front-end

The reason you might not be able to remove the Open Sans font that Wordpress >= 3.8 adds to the frontend is that quite a few WP styles and scripts list 'open-sans' as a dependancy when being registered and enqueued. When you remove the 'open-sans' style the other plugins dependant on it will not load. So you just need to deregister WP's open sans style and register your own, with a false value for the src like below.

Credit to seventhsteel from http://wordpress.org/support/topic/turning-off-open-sans-for-the-38-dashboard

@thetrickster
thetrickster / Gruntfile.js
Created January 31, 2014 21:17
Foundation 5 Gruntfile.js to compile sass with libsass and copy bower components to /js/ in your project. Run `npm install && bower install` and then `grunt` to watch
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
@thetrickster
thetrickster / config.rb
Created January 31, 2014 02:03
Compass Wordpress Theme SCSS Helper -- This updated config.rb file has a ruby method that compiles /scss/styles.scss and copies the style.css file out of /scss/ and into the project root. Works best for a WP theme development workflow.
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
/**
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your