Skip to content

Instantly share code, notes, and snippets.

Simon Blackbourn lumpysimon

Block or report user

Report or block lumpysimon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
prefix = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload'),
input = {
'sass': [
'sass/**/*.scss'
]
@lumpysimon
lumpysimon / .gitignore
Last active Oct 4, 2019
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
@lumpysimon
lumpysimon / .htaccess
Created Jun 16, 2019
.htaccess short WordPress URLs
View .htaccess
# e.g. https://example.org/go/76
RewriteEngine On
RewriteRule ^go/([0-9]+)$ ?p=$1 [R=301,L]
@lumpysimon
lumpysimon / delete-spam-comment.sql
Created Jun 16, 2019
MySQL commands to delete spam WordPress comments & commentmeta
View delete-spam-comment.sql
delete from wp_comments where comment_approved='spam';
delete from wp_commentmeta where comment_id not in (select comment_id from wp_comments);
delete from wp_commentmeta where meta_key like '%akismet%';
@lumpysimon
lumpysimon / limit-checkboxes.js
Created Jun 16, 2019
jQuery snippet to limit how many checkboxes can be checked
View limit-checkboxes.js
$( '.things' ).click( function() {
var bol = $( '.things:checked' ).length >= 8;
$( '.things' ).not( ':checked' ).attr( 'disabled', bol );
});
// from http://stackoverflow.com/questions/2966382/limit-checkbox-amount
@lumpysimon
lumpysimon / .lando.yml
Last active Feb 28, 2019
Lando config file for WordPress with Apache, PHP 7.2, Xdebug, MailHog and PHPMyAdmin
View .lando.yml
name: mysite
recipe: wordpress
config:
php: '7.2'
webroot: public
xdebug: true
conf:
php: .vscode/php.ini
proxy:
mailhog:
@lumpysimon
lumpysimon / dequeue-wordpress-block-library-styles.php
Last active Jan 4, 2019
Dequeue the WordPress block editor stylesheet if the Classic Editor plugin is activated and configured
View dequeue-wordpress-block-library-styles.php
add_action( 'wp_enqueue_scripts', 'simon_dequeue_block_editor_styles' );
function simon_dequeue_block_editor_styles() {
if ( 'classic' === get_option( 'classic-editor-replace' ) ) {
wp_dequeue_style( 'wp-block-library' );
}
}
@lumpysimon
lumpysimon / tiny-mce.php
Last active Dec 5, 2018
Configure the default WordPress TinyMCE behaviour, defaults and buttons
View tiny-mce.php
<?php
defined( 'ABSPATH' ) or die();
$lumpy_lemon_tiny_mce = new lumpy_lemon_tiny_mce;
@lumpysimon
lumpysimon / gist:545c54e2876ebcbaf3c0
Created Jul 7, 2015
Set the WordPress password-protected post cookie expiry time
View gist:545c54e2876ebcbaf3c0
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 / wp-remove-emoji.php
Created Sep 4, 2016
Remove WordPress emoji shit
View wp-remove-emoji.php
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
You can’t perform that action at this time.