Skip to content

Instantly share code, notes, and snippets.

View wpmark's full-sized avatar

Mark Wilkinson wpmark

View GitHub Profile
@pento
pento / php-block.js
Last active February 29, 2024 01:31
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@GaryJones
GaryJones / notes.md
Last active October 24, 2023 19:12
Add PHPCS + WPCS to Sublime Text 3

Install PHP_CodeSniffer (PHPCS) via git

You can use the .phar for PHPCS, but it's easier to pull the repo down from git to then choose what version to use.

cd ~
mkdir -p code
cd code
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@isarmstrong
isarmstrong / class.social-share.php
Last active August 29, 2015 14:16
A class file that outputs social sharing buttons for WordPress, instantiated by array
<?php
/**
* Class social_share
* @author : Ian Armstrong (@imperativeideas)
* A class file that outputs social sharing buttons for WordPress, instantiated by array
*/
/* Sample Usage:
@stompweb
stompweb / gist:11321145
Last active August 29, 2015 14:00
Change menu classes
<?php
function register_my_page() {
global $my_page;
$my_page = add_menu_page( 'My Page', 'My Page', 'edit_pages', 'my_page.php', 'my_page_hook', 'dashicons-groups', 4 );
}
add_action('admin_menu', 'register_my_page');
function highlight_different_menu($parent_file){
@richardW8k
richardW8k / RWNotificationExtras.php
Last active September 30, 2021 21:17
Adds a new settings to Gravity Forms notifications allowing uploaded files to be attached to the notification and the notification format to be changed to text.
<?php
/**
* Plugin Name: Gravity Forms - Notification Extras
* Author: Richard Wawrzyniak
* Description: Adds new settings to Gravity Forms Notifications enabling file uploads to be attached to notifications and the notification format to be changed to text.
* Version: 1.0
*
* Last Modified: 17/10/2014
* Updated attach_file() to allow for possibility that uploads folder was changed
* Added suppot for post_image fields
@Latz
Latz / disablexmlrpc
Created September 28, 2012 15:17
Sample plugin for diabling XMLRPC server for WordPress >= v3.5
<?php
/**
* Plugin Name: Disable XMLRPC
* Version: 0.1
* Plugin URI: http://wpengineer.com/?p=2484
* Description: Disable XMLRPC server for WP >= v3.5
* Author: Lutz Schröer
* Author URI: http://elektroelch.net/
*/