Skip to content

Instantly share code, notes, and snippets.

View mrwweb's full-sized avatar

Mark Root-Wiley mrwweb

View GitHub Profile
@isaumya
isaumya / functions.php
Created September 9, 2016 20:43
Attach files with Gravity Forms Notification Emails - Gravity Forms
<?php
//* Attaching file to the form notification user email
//* in gform_notification_7, the number 7 is the FORM ID
//* This snippet works with the newer version of Gravity Forms too
add_filter('gform_notification_7', 'add_attachment_pdf', 10, 3); //target form id 7, change to your form id
function add_attachment_pdf( $notification, $form, $entry ) {
//There is no concept of user notifications anymore, so we will need to target notifications based on other criteria,
//such as name or subject
if($notification["name"] == "User Notification - Life Lesson"){
//get upload root for WordPress
@trepmal
trepmal / toggle-debug.php
Last active September 4, 2020 15:42
WordPress experiment. Toggle debug from admin bar
<?php
/*
Plugin Name: Toggle Debug
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love.
*/
/*
// In wp-config.php, wrap debug constants in a cookie conditional
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) {
define('WP_DEBUG', true);
}
@leonderijke
leonderijke / svgfixer.js
Last active May 26, 2023 11:22
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@Viper007Bond
Viper007Bond / whatissoslow.php
Last active October 29, 2023 14:23
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@markjaquith
markjaquith / gist:4487609
Created January 8, 2013 20:25
WordPress ASCII art.
<!--
`-/+osssssssssssso+/-`
./oys+:.` `.:+syo/.
.+ys:. .:/osyyhhhhyyso/:. ./sy+.
/ys: -+ydmmmmmmmmmmmmmmmmmmdy+- :sy/
/h+` -odmmmmmmmmmmmmmmmmmmmmmmmmmmdo- `+h/
:ho` /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmds/ `oh:
`sy. /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmd+ .ys`
.ho `sdddhhhyhmmmdyyhhhdddddhhhyydmmmmy oh.
@thefuxia
thefuxia / t5-fresh-editor-stylesheets.php
Created July 21, 2012 06:46
T5 Fresh Editor Stylesheets
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Fresh Editor Stylesheets
* Description: Enforces fresh editor stylesheets per version parameter.
* Version: 2012.08.09
* Author: Thomas Scholz
* Plugin URI: http://toscho.de/?p=1965
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
@afragen
afragen / tribe-ical-outlook-modify.php
Last active June 8, 2022 21:07
Modify Event Calendar iCal feed properties for Outlook
<?php
//Add the following to your theme's functions.php
add_filter( 'tribe_ical_properties', 'tribe_ical_outlook_modify', 10, 2 );
function tribe_ical_outlook_modify( $content ) {
$properties = preg_split ( '/$\R?^/m', $content );
$searchValue = "X-WR-CALNAME";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $properties);
$key = array_values($fl_array);
$keynum = key($fl_array);