Skip to content

Instantly share code, notes, and snippets.

John Blackbourn johnbillion

View GitHub Profile
@johnbillion
johnbillion / gist:11369697
Created Apr 28, 2014
zzmag contributors
View gist:11369697
@johnbillion: 14
@negatendo: 7
@karlfreeman: 5
@torrez: 5
@notch: 2
@boonych: 2
@mikesten: 1
@cityofprogress: 1
@darrenux: 1
@jansru: 1
@johnbillion
johnbillion / install-popular-themes.sh
Last active Feb 27, 2017
Install all the "Popular" themes from WordPress.org using wp-cli and jq
View install-popular-themes.sh
@johnbillion
johnbillion / install-all-languages.sh
Created Feb 18, 2017
Install all available languages on a WordPress site with WP-CLI
View install-all-languages.sh
wp core language list --field=language | xargs -n 1 wp core language install
@johnbillion
johnbillion / plugin.php
Last active Nov 20, 2017 — forked from joncave/plugin.php
First pass at removing the vulnerabilities from this plugin. Untested. *bites nails*
View plugin.php
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
@johnbillion
johnbillion / roles.sh
Created Nov 22, 2017
Create a user account for each role on your WordPress site
View roles.sh
# wp-cli: http://wp-cli.org/
wp role list --fields=role --format=csv \
| tail -n +2 \
| xargs -I {} wp user create "user-{}" "{}@example.com" --role={}
@johnbillion
johnbillion / gist:5225514
Last active May 29, 2019
Post Meta Revisions
View gist:5225514
<?php
/*
Plugin Name: Post Meta Revisions
Description: Revisions for the 'foo' post meta field
Version: 1.0
Author: John Blackbourn
Plugin URI: http://lud.icro.us/post-meta-revisions-wordpress
*/
View merge.sh
#!/bin/bash
REV=$1
svn up --ignore-externals . > /dev/null
svn merge -c$REV ../../trunk .
LOG=$(svn log -r$REV ../../trunk | grep -v '\-------' | tail -n +3)
BRANCH=$(basename $(pwd))
echo -en "$LOG\n\nMerges [$REV] to the $BRANCH branch." | pbcopy
echo ""
pbpaste
@johnbillion
johnbillion / install-debug-bar-extensions.sh
Last active Sep 18, 2019
Use WP-CLI to install a load of Debug Bar extensions (which work with Query Monitor too) in one go
View install-debug-bar-extensions.sh
# wp-cli: http://wp-cli.org/
wp plugin search debug-bar --field=slug --format=csv --per-page=50 \
| grep -F 'debug-bar-' \
| xargs -n 1 wp plugin install
View template-part-block-renderer.php
<?php
namespace Foo\Blocks;
/**
* Generic block rendering callback function to load a block from a theme template part.
*
* Loads a block from the `blocks` subdirectory according to the name of the block, and places the
* block attributes and block content into namespaced query vars. If there's no corresponding block
* template part, the block content is returned unaltered.
You can’t perform that action at this time.