Skip to content

Instantly share code, notes, and snippets.

@lumpysimon
lumpysimon / gist:5a68f561fd2381e64efe
Last active March 8, 2016 17:06
Example WordPress custom post type and taxonomy definitions using Extended CPTs and Extended Taxos
register_extended_post_type(
'newsletter',
array(
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 45,
'quick_edit' => false,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'admin_cols' => array(
'newsletter-image' => array(
@lumpysimon
lumpysimon / gist:2942fa7d71859c35f566
Created October 1, 2014 14:27
Better XML Sitemaps (WordPress plugin): set cache folder and exclude pages
<?php
defined( 'ABSPATH' ) or die();
$ll_sitemap = new ll_sitemap;
@lumpysimon
lumpysimon / lumpy-responsive-columns.htm
Created June 18, 2014 20:35
Responsive columns HTML markup
<section class="cols">
<div class="col col-3-5">
<div class="cols">
<div class="col col-1-3">
<div class="button">one third of three fifths</div>
</div>
<div class="col col-1-3">
<div class="button">one third of three fifths</div>
</div>
<div class="col col-1-3">
@lumpysimon
lumpysimon / lumpy-responsive-columns.scss
Created June 18, 2014 20:32
SASS/SCSS responsive columns
/*
===========
= columns =
===========
*/
$gutter: 4%;
@lumpysimon
lumpysimon / .gitignore
Last active April 5, 2022 00:37
A .gitignore file for WordPress that ignores pretty much everything except for the specified plugin(s), theme(s) and mu-plugins folder
# .gitignore file for WordPress that ignores everything except:
#
# - .gitignore
# - favicon.ico
# - wp-config.php
# - everything in mu-plugins
# - my-plugin
# - my-theme (except for .sass-cache)
#
# based on https://gist.github.com/jdbartlett/444295
@lumpysimon
lumpysimon / WordPress Webkit Line Height Fixer
Last active August 29, 2015 13:55
Quick n dirty fix to strip out the line height styles inserted by Webkit browsers when saving posts in WordPress.
<?php
/*
Plugin Name: Webkit Line Height Fixer
Plugin URI: https://twitter.com/lumpysimon
Description: Remove the annoying inline line-height styles added by Webkit
Version: 1.0
Author: Simon Blackbourn @ Lumpy Lemon
Author URI: http://lumpylemon.co.uk
@lumpysimon
lumpysimon / gist:5583782
Created May 15, 2013 12:51
PHP backtrace
$trace=debug_backtrace();
$caller=array_shift($trace);
error_log( "Lumpy: mail debug function " . print_r( $trace[0]['function'] , true ) );
error_log( "Lumpy: mail debug class " . print_r( $caller['class'] , true ) );
@lumpysimon
lumpysimon / gist:5212084
Last active December 15, 2015 05:49 — forked from twosixcode/gist:1988097
Sublime Text key binding: swap paste & paste-and-indent (put in Preferences -> Key Bindings - User)
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@lumpysimon
lumpysimon / Lumpy function.sublime-snippet
Created March 21, 2013 10:19
Sublime Text snippet: PHP function with arg & default
<snippet>
<content><![CDATA[
function ${1:name}(${2: \$${3:arg} ${4:= $5 }}) {
$0
}
@lumpysimon
lumpysimon / Lumpy error log.sublime-snippet
Created March 21, 2013 10:18
Sublime Text snippet: PHP error_log print_r
<snippet>
<content><![CDATA[error_log( "Lumpy: $1 " ${2:. print_r( \$$3 , true )} );]]></content>
<tabTrigger>lel</tabTrigger>
<scope>source.php</scope>
<description>error_log (Lumpy PHP)</description>
</snippet>