Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
/* global jQuery, wp */
jQuery( function( $ ) {
var initializeAllClocks, initializeClock;
/**
* Find clocks.
*
* @param [container] Scoping element for finding clock elements.
* @returns {void}
@matthewjackowski
matthewjackowski / wordpress.vcl
Last active December 27, 2022 02:56
Varnish 4 VCL configuration for WordPress. Also allows purging
# A heavily customized VCL to support WordPress
# Some items of note:
# Supports https
# Supports admin cookies for wp-admin
# Caches everything
# Support for custom error html page
vcl 4.0;
import directors;
import std;
@richaber
richaber / filter_oembed.php
Created January 11, 2016 05:08
Filter the WordPress oembed_fetch_url and oembed_result to maintain URL query args
<?php
/**
* Add params back to oEmbed provider request URL.
*
* WordPress runs the embed URL through urlencode prior to constructing it's oEmbed provider endpoint call.
* This renders any passed in URL query params useless for Vimeo embeds (and probably others).
* This filter function will decode those URL query param, and add them as proper query args to the provider URL.
*
* The first function param, $provider, is the oEmbed provider endpoint.
@mathetos
mathetos / plugin.php
Last active April 13, 2023 16:48
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
<?php
/**
* Whitelist embedded links in the REST API responses
*
* This is often useful if you want to only get specified resources embedded along with the
* main resources, rather than the "all of nothing" approach of passing `?_embed` to the API request.
*
* You can either pass a comma seperated list of relationships or an array of string via the `_embed_include` query param.
*
@johnbillion
johnbillion / wp_mail.md
Last active May 12, 2024 14:19
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

@morganestes
morganestes / .readme.md
Last active November 9, 2022 18:07
Create multiple sites with wp-cli in WordPress multisite for testing.

These commands will install multiple dummy sites in a WordPress Multisite environment.

I wrote this to easily create an environment to work on https://core.trac.wordpress.org/ticket/15317.

Usage

Shell

In the terminal, inside your WordPress directory: simply copy, paste, and run the one-line command.

You can also add it to a location available in your $PATH and invoke the script from the shell.

@neilgee
neilgee / custom-provision.sh
Created July 13, 2015 02:58
Custom VVV Variable Provisioning for WordPress sites
# #!/bin/bash
# #
# # provision.sh
# #
# # This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# # provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# # or `vagrant reload` are used. It provides all of the default packages and
# # configurations included with Varying Vagrant Vagrants.
# # By storing the date now, we can calculate the duration of provisioning at the
@SGudbrandsson
SGudbrandsson / index.php
Last active June 10, 2023 01:11
Create a WordPress staging area from your live wordpress setup with a Click-of-a-button [TM] ..
<?php
/**
*
* This script will copy your wordpress from public_html (or wherever)
* and place it in a staging folder.
* It will then clone the database, reconfigure the config file
* and replace URL's from the original URL to your staging URL.
* It will then make sure to NOT allow search engines to index the page.
*
* Use this script to clone your main wp in order to test maintenance work
@lumpysimon
lumpysimon / gist:5a68f561fd2381e64efe
Last active March 8, 2016 17:06
Example WordPress custom post type and taxonomy definitions using Extended CPTs and Extended Taxos
register_extended_post_type(
'newsletter',
array(
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 45,
'quick_edit' => false,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'admin_cols' => array(
'newsletter-image' => array(