Instantly share code, notes, and snippets.

Simon Blackbourn lumpysimon

View GitHub Profile
@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' );
@lumpysimon
lumpysimon / .htaccess
Last active Aug 1, 2018
.htaccess file for WordPress sites, with Strict Transport Security header and various caching improvements
View .htaccess
Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
Header set X-Powered-By "WordPress and Lumpy Lemon"
AddDefaultCharset UTF-8
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
</IfModule>
<IfModule mod_headers.c>
@lumpysimon
lumpysimon / meta-tags.php
Last active Jul 10, 2018
Kirby meta tags config file
View meta-tags.php
<?php
c::set('meta-tags.default', function(Page $page, Site $site) {
if ( $page->isErrorPage() )
return [
'title' => $page->title()
];
$title = ( $page->isHomePage() ? $site->title() : $page->title() . ' - ' . $site->title() );
@lumpysimon
lumpysimon / vs-code-settings.json
Last active Jul 7, 2018
VS Code workplace settings with title bar colouring
View vs-code-settings.json
{
"folders": [
{
"path": "/path/to/my/workspace/folder"
}
],
"settings": {
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#d12229",
"titleBar.activeForeground": "#ffffff",
@lumpysimon
lumpysimon / .lando.yml
Last active May 16, 2018
Lando config file for WordPress with Nginx, PHP 7.2, MySQL 5.5, Xdebug, MailHog and PHPMyAdmin
View .lando.yml
name: mysite2
recipe: wordpress
config:
php: '7.2'
via: nginx
webroot: public
xdebug: true
conf:
php: .vscode/php.ini
proxy:
@lumpysimon
lumpysimon / .lando.yml
Last active May 16, 2018
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 / .lando.yml
Created May 16, 2018
Lando config file for Kirby with Apache, PHP 7.2, SSL and MailHog
View .lando.yml
name: kirby
proxy:
appserver:
- kirby.lndo.site
mailhog:
- mail.kirby.lndo.site
services:
appserver:
type: php:7.2
via: apache