Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / .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 / 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: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:545c54e2876ebcbaf3c0
Created July 7, 2015 16:04
Set the WordPress password-protected post cookie expiry time
add_filter( 'post_password_expires', 'my_cookie_time' );
function my_cookie_time( $time ) {
return 600; // 600 = 10 minutes. Use 0 to expire the cookie at the end of the current browsing session.
}
@lumpysimon
lumpysimon / hyphenate.css
Created September 30, 2015 23:53
Bulletproof hyphenation using CSS
.hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
@lumpysimon
lumpysimon / wp-disable-rest.php
Created November 26, 2015 22:44
Completely disable WordPress REST API
add_filter( 'rest_enabled', '_return_false' );
add_filter( 'rest_jsonp_enabled', '_return_false' );