Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active November 15, 2024 10:17
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@thomasfw
thomasfw / wpmail-enhanced-attachments.php
Last active October 18, 2024 18:53
Enable non-filesystem attachments with wp_mail()
<?php
/**
* Plugin Name: Enhanced WP Mail Attachments
* Plugin URI: https://gist.github.com/thomasfw/5df1a041fd8f9c939ef9d88d887ce023/
* Version: 0.1
*/
/**
* Adds support for defining attachments as data arrays in wp_mail().
@rafsuntaskin
rafsuntaskin / functions.php
Created April 12, 2021 20:39
Change Event Tickets CSV export delimiter
<?php
add_filter( 'tribe_tickets_attendees_csv_export_delimiter', 'rt_et_change_csv_export_delimiter' );
function rt_et_change_csv_export_delimiter( $default ) {
return '.';
}
@westonruter
westonruter / shutdown-handler.php
Last active March 22, 2019 18:48
Disable WSOD detection on WordPress 5.1 so that fatal errors during development don't constantly cause plugins to suspend
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
/*
* Plugin Name: Non-Handling Shutdown Handler
* Description: Disable WSOD protection so that plugins will not auto-suspend during development while errors often occur.
* Plugin URI: https://gist.github.com/westonruter/583a42392a0b8684dc268b40d44eb7f1
* Plugin Author: Weston Ruter
*/
/**
@roborourke
roborourke / wp-react-dev.php
Last active May 17, 2020 13:50
Get the development version of react in WordPress without needing a dev version of WP
<?php
/**
* Enable dev mode vendor packages.
*/
if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) {
return;
}
add_action( 'init', function () {
@westonruter
westonruter / jetpack-amp-gist.php
Last active June 2, 2020 06:13
[OBSOLETE] Temporary AMP compatibility shim for Gist embedding in Jetpack (until PR #10053 is merged). For use with the AMP plugin.
<?php
/**
* Plugin Name: Jetpack amp-gist
* Description: Temporary AMP compatibility shim for Gist embedding in Jetpack (until <a href="https://github.com/Automattic/jetpack/pull/10053">PR #10053</a> is merged). For use with the <a href="https://github.com/Automattic/amp-wp">AMP plugin</a>.
* Plugin URI: https://gist.github.com/westonruter/8c91e3a218eeb1403ce2eacb832c0783
* Version: 0.1
* Author: Weston Ruter
* Author URI: https://weston.ruter.net
*/
<?php
/**
* Plugin Name: YOUR PLUGIN NAME
*/
include( dirname( __FILE__ ) . '/lib/requirements-check.php' );
$your_plugin_requirements_check = new YOUR_PREFIX_Requirements_Check( array(
'title' => 'YOUR PLUGIN NAME',
'php' => '5.4',
@johnbillion
johnbillion / install-debug-bar-extensions.sh
Last active September 5, 2024 01:56
Use WP-CLI to install a load of Debug Bar extensions (which work with Query Monitor too) in one go
# wp-cli: http://wp-cli.org/
wp plugin search debug-bar --field=slug --format=csv --per-page=50 \
| grep -F 'debug-bar-' \
| xargs -n 1 wp plugin install
@ParsonsProjects
ParsonsProjects / customizer.php
Last active August 20, 2020 11:23
Integration of Wordpress Polylang and the Customizer
add_action( 'customize_register' , 'my_options' );
function home_page_options( $wp_customize ) {
// get current lang
$language = (empty($_REQUEST['lang'])) ? 'en_' : $_REQUEST['lang'] . '_';
$wp_customize->add_setting( $language . 'my_field',
array(
'default' => ''
/* Make sure edit shortcut for nab body class doesn't conflict with nav menu edit shortcut */
.customize-partial-edit-shortcut-nav_body_class > .customize-partial-edit-shortcut-button {
top: -30px;
}
/* Example styles */
body.foo nav {
border: solid 2px red !important;
}