Skip to content

Instantly share code, notes, and snippets.


Andrew Killen andykillen

View GitHub Profile
View xmlUpdateWooCommerce.php
* copyrights andrew killen 2017
* Attribution-ShareAlike 4.0 International.
* This will get the contents from the db about the current values, optionally if you have setup
View user-roles-plugin.php
Plugin Name: New User Roles
Plugin URI:
Description: Adds additional role(s)
Version: 1.0
Author: Andrew Killen
function new_user_roles_plugin_activation() {
andykillen / ClearSwiftCacheCommentApproved.php
Last active Dec 1, 2018
PSR-0 style class with static methods to delete the SWIFT caches on comment approval.
View ClearSwiftCacheCommentApproved.php
* PSR-0 style class with static methods to delete the SWIFT caches on comment approval.
* To make this PSR-4 add a namespace, and prefix Swift_Performance_Cache with a \
* I think its much better that way and saves the much larger Class name.
* I've included the init at the bottom, but normally I would have that in a place with all
* other calls so that they are easily visible, like the functions.php
andykillen / enabled_modules.txt
Created Apr 3, 2018
list of enabled modules
View enabled_modules.txt
andykillen / page-facebookimage.php
Created Jan 28, 2018
Show an image to facebook, but show a full page to users
View page-facebookimage.php
* Template Name: Facebook sees the image
* Force no caching, just in case you have some fancy varnish, load balancer
* or other things
andykillen / page-quizredirect.php
Created Jan 28, 2018
WordPress page template, redirect to Quiz url if not facebook.
View page-quizredirect.php
* Template Name: Facebook quiz redirect
function check_if_facebook(){
* this function checks if the current thing accessing the site is a facebook
* bot or not.
andykillen / .gitignore
Created Feb 9, 2017
my standard gitignore for WP
View .gitignore
/* ignore netbeans */
/* ignore WP core and misc for wordpress on */
andykillen /
Created Dec 16, 2016
Run this script in the wp-content/uploads directory, first making sure you have installed jpegoptim and pngcrush. change 1920> to 3.840> if you worry about @2x retina images
for f in $(find . -name '*.jpg' -or -name '*.JPG' -or -name '*.JPEG' -or -name '*.jpeg' -or -name '*.png'); do
convert "$f" -resize "1920>" "$f";
andykillen / create-wget-for-bash.php
Last active Dec 15, 2016
Checks through a db looking for posts table and creates a text file with all the wget commands to retrieve the images of the site. To run just load the php file, enter the form fields and then after it has created the txt file run is 'bash wp_posts.txt' at the terminal.
View create-wget-for-bash.php
<!doctype html>
<meta charset="utf-8" />
<title>Search for all images on WordPress and download to directory via WGET task list</title>
<h1>Search for all images on WordPress and download to directory via WGET task list</h1>
View Change the Args of WP_Query.php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => '5'
'no_found_rows' => true, // turn off pagination information
'update_post_meta_cache' => false // don't do anything with post meta cache
You can’t perform that action at this time.