Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
@thomasfw
thomasfw / wpmail-enhanced-attachments.php
Last active March 20, 2024 23:47
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 18, 2019 02:35
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;
}
@westonruter
westonruter / trac-39128-customizer-cross-domain-workaround.php
Last active July 25, 2023 02:37
WordPress Plugin for Customizer Cross-Domain Workaround (Trac #39128)
<?php
/**
* Plugin Name: Customizer Cross-Domain Workaround (Trac #39128)
* Description: Force customizer preview to use siteurl instead of home URL to work around Trac #39128. Temp fix for issue loading customizer preview when home and siteurl have different domains (cross-domain).
* Plugin URI: https://core.trac.wordpress.org/ticket/39128
* Author: Weston Ruter, XWP
* Author URI: https://make.xwp.co/
*
* Copyright (c) 2017 XWP (https://xwp.co/)
*