Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
/* 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/)
*
/* global jQuery, wp */
jQuery( function( $ ) {
var initializeAllClocks, initializeClock;
/**
* Find clocks.
*
* @param [container] Scoping element for finding clock elements.
* @returns {void}
@ravibhure
ravibhure / git_rebase.md
Last active July 22, 2025 20:33
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@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 July 7, 2025 13:21
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.