Instantly share code, notes, and snippets.

Simon Blackbourn lumpysimon

View GitHub Profile
@lumpysimon
lumpysimon / WordPress Webkit Line Height Fixer
Last active Aug 29, 2015
Quick n dirty fix to strip out the line height styles inserted by Webkit browsers when saving posts in WordPress.
View WordPress Webkit Line Height Fixer
<?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 / .gitignore
Last active Aug 29, 2015
A .gitignore file for WordPress that ignores pretty much everything except for the specified plugin(s), theme(s) and mu-plugins folder
View .gitignore
# .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
View lumpy-responsive-columns.scss
/*
===========
= columns =
===========
*/
$gutter: 4%;
@lumpysimon
lumpysimon / lumpy-responsive-columns.htm
Created Jun 18, 2014
Responsive columns HTML markup
View lumpy-responsive-columns.htm
<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 Oct 1, 2014
Better XML Sitemaps (WordPress plugin): set cache folder and exclude pages
View gist:2942fa7d71859c35f566
<?php
defined( 'ABSPATH' ) or die();
$ll_sitemap = new ll_sitemap;
@lumpysimon
lumpysimon / gist:1989492
Created Mar 6, 2012
wordpress page.php
View gist:1989492
<?php
get_header();
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
@lumpysimon
lumpysimon / gist:1989756
Created Mar 6, 2012
wordpress get attached images slideshow
View gist:1989756
$args = array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image/jpeg',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1
);
$slides = get_posts( $args );
@lumpysimon
lumpysimon / gist:2393401
Created Apr 15, 2012
css speech bubbles
View gist:2393401
/*
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
wordpress set display name based on first name & last name
View gist:2630992
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 Mar 21, 2013
Sublime Text snippet: WordPress add_action / add_filter in class PHP
View Lumpy add_.sublime-snippet
<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>