Skip to content

Instantly share code, notes, and snippets.

View mattradford's full-sized avatar
👋

Matt Radford mattradford

👋
View GitHub Profile
#!/bin/sh
# https://dl.ubnt.com/unifi/5.11.46/unifi_sh_api
#username=ubnt
#password=ubnt
#baseurl=https://unifi:8443
#site=default
#[ -f ./unifi_sh_env ] && . ./unifi_sh_env
cookie=$(mktemp)
@amjad
amjad / json_sync_acf_fields.php
Last active October 1, 2021 09:42 — forked from superpositif/jp_sync_acf_fields.php
Automatically update Advanced Custom Fields field groups via JSON
<?php
/**
*
* Function that will automatically remove ACF field groups via JSON file update
*
*/
function acf_auto_suppr($json_dirs) {
$groups = acf_get_field_groups();
if (empty($groups)) {
@Luc45
Luc45 / serve-wordpress-multisite.sh
Created December 22, 2018 15:36
WordPress Multisite serve script for Nginx (Homestead, etc)
#!/usr/bin/env bash
block="# WordPress multisite subdirectory rules.
# Designed to be included in any server {} block.
map \$uri \$blogname{
~^(?P<blogpath>/[^/]+/)files/(.*) \$blogpath ;
}
map \$blogname \$blogid {
default -999;
<?php
namespace DeliciousBrains\Admin;
use DeliciousBrains\DBI;
class ACF {
public function init() {
add_filter( 'acf/settings/save_json', array( $this, 'get_local_json_path' ) );
@pshapiro
pshapiro / index.js
Created November 28, 2017 06:46
Puppeteer Crawler Example
var Walker = require('puppeteer-walker')
var fs = require('fs')
var walker = Walker()
fs.writeFile('output.csv', 'URL, Title, H2\r\n', 'utf8', function (err) {
console.log(`Header written`)
})
walker.on('end', () => console.log('finished walking'))
@felixarntz
felixarntz / wp-alignment-classes.css
Created November 24, 2017 15:52
New WordPress alignment classes introduced by Gutenberg
/* -------------------------------------------------------------
# Variables
------------------------------------------------------------- */
$site_maxwidth: 72rem; // Maximum width the entire site should not exceed
$site_maxwidth-text: 40rem; // Maximum width the main content text should not exceed
$spacing_horizontal: 1rem; // General horizontal padding
/* -------------------------------------------------------------
# General Styles
@lukecav
lukecav / gist:4224fbb2a57383e3cc511f136697ef58
Last active June 30, 2020 08:23
gravity-forms-list-field-datepicker-plugin.php
<?php
/*
Plugin Name: Date Picker in List Fields for Gravity Forms
Description: Gives the option of adding a date picker to a list field column
Version: 1.6.2
Author: Adrian Gordon
Author URI: http://www.itsupportguides.com
License: GPL2
Text Domain: gravity-forms-list-field-date-picker
@danielbachhuber
danielbachhuber / cache-purge.php
Created February 22, 2016 17:34
Trigger Varnish cache purge on deploy to WP Engine
<?php
add_action( 'init', function(){
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own.
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) {
WpeCommon::purge_varnish_cache_all();
echo 'Cache purged';
exit;
}
});
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)
@mapsam
mapsam / README.md
Created April 25, 2014 00:37
Inline SVG partial for WordPress

Good for acting on specific pieces of your SVG object instead of just link as an <img> you can bring the entire object into your HTML. You need two things:

  1. SVG file with a double extension ending with .php - e.g. logo.svg.php
  2. WP include statement with the built-in function get_template_part
<?php
get_template_part( 'includes/partials/logo', 'logo.svg' );
?>