Skip to content

Instantly share code, notes, and snippets.

@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 / lumpy-responsive-columns.scss
Created June 18, 2014 20:32
SASS/SCSS responsive columns
/*
===========
= columns =
===========
*/
$gutter: 4%;
@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 / 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 / gist:1989492
Created March 6, 2012 22:37
wordpress page.php
<?php
get_header();
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
@lumpysimon
lumpysimon / gist:2393401
Created April 15, 2012 15:20
css speech bubbles
/*
CSS Speech Bubbles
Usage: Apply a class of .speech-bubble and .speech-bubble-DIRECTION
<div class="speech-bubble speech-bubble-top">Hi there</div>
From: http://net.tutsplus.com/tutorials/html-css-techniques/css-refreshers-borders/
*/
.speech-bubble {
position: relative;
background-color: #292929;
@lumpysimon
lumpysimon / gist:2630992
Created May 7, 2012 22:24
wordpress set display name based on first name & last name
add_filter( 'pre_user_display_name', 'default_display_name' );
function default_display_name( $name ) {
if ( isset( $_POST['display_name'] ) )
return sanitize_text_field( $_POST['display_name'] );
if ( isset( $_POST['first_name'] ) ) {
$name = sanitize_text_field( $_POST['first_name'] );
@lumpysimon
lumpysimon / Lumpy add_.sublime-snippet
Created March 21, 2013 10:07
Sublime Text snippet: WordPress add_action / add_filter in class PHP
<snippet>
<content><![CDATA[
add_${1:action}( '${2:hook}', $5array( \$this, '${3:function}' )${4:, 10, 2} );]]></content>
<tabTrigger>lwpadd</tabTrigger>
<scope>source.php</scope>
<description>add_action or add_filter (Lumpy WordPress PHP)</description>
</snippet>
@lumpysimon
lumpysimon / Lumpy reg ext post type.sublime-snippet
Created March 21, 2013 10:09
Sublime Text snippet: WordPress register_extended_post_type PHP
<snippet>
<content><![CDATA[
${1: if ( function_exists( 'register_extended_post_type' ) ) \{
}${3: } register_extended_post_type(
${3: } '${4:name}',
${3: } array(
${3: }${16: ${5:'capability_type' => 'post',
${3: } }${6:'hierarchical' => false,
${3: } }${7:'menu_position' => ${8:99},
@lumpysimon
lumpysimon / Lumpy class.sublime-snippet
Last active December 15, 2015 05:49
Sublime Text snippet: PHP class with __construct function
<snippet>
<content><![CDATA[
defined( 'ABSPATH' ) or die();
\$$1 = new $1;