Skip to content

Instantly share code, notes, and snippets.


Brian Gallagher bgallagh3r

View GitHub Profile
bgallagh3r / functions.php
Created Dec 11, 2020 — forked from kloon/functions.php
WooCommerce 3.2: Add resend admin order email option that was removed
View functions.php
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2
* Filter to add a new menu to the dropdown
* @param array $actions
* @return array
bgallagh3r / wp-dashboard.php
Created Aug 18, 2015
Set WordPress Dashboard to Single Column
View wp-dashboard.php
// force one-column dashboard
function shapeSpace_screen_layout_columns($columns) {
$columns['dashboard'] = 1;
return $columns;
add_filter('screen_layout_columns', 'shapeSpace_screen_layout_columns');
function shapeSpace_screen_layout_dashboard() { return 1; }
add_filter('get_user_option_screen_layout_dashboard', 'shapeSpace_screen_layout_dashboard');
bgallagh3r / hosts.ps1
Created Dec 10, 2014
Powershell script to add/edit/list/remove entries from the hosts file.
View hosts.ps1
Set-ExecutionPolicy RemoteSigned
# Edit HOSTS file Script
# Brian Gallagher (
# If you use Sublime text, and don't have an alias for it yet, uncomment the line below and change the path to ST
#Set-Alias st 'C:\Program Files\Sublime Text 3\sublime_text.exe'
$file = join-path -path $env:SystemRoot -childpath "System32\drivers\etc\hosts"
# Installation script for a Wordpress 3.0 website on Ubuntu 10.04
# Josh Kersey
# Created: May 15, 2012
# Last Update: June 13, 2012
# get setup parameters
echo "apache vhost name (one word):"
View mirc.ini
bgallagh3r / QueryBuilder.php
Created Sep 11, 2014
A helper class to build prepared statements using WordPress's WPDB class.
View QueryBuilder.php
* A helper class to allow you to easily build prepared statements
* for use with Wordpress's WPDB class.
* Usage: $this->orderBy('column', 'asc')->limit(50)->getQuery();
class QueryBuilder {
bgallagh3r / FeatureContext.php
Last active Apr 8, 2018
Behat FeatureContext Bootstrap for use in Laravel.
View FeatureContext.php
// Put this inside of your featurecontext class
// This assumes the FeatureContext.php class is within app/tests/behat/features/bootstrap
// Another thing to note... I'm using sqlite in memory for these tests,
// so I'm not worried about the db at the end of the run, just the install and start.
class FeatureContext extends BehatContext //or MinkContext if using Mink
bgallagh3r / template
Last active Apr 8, 2018 — forked from gistwebdev/template
Updated to work with Apache 2.4 (swap order/allow for Required all granted)
View template
<VirtualHost *:80>
ServerName template.url
DocumentRoot template.webroot
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
bgallagh3r / vhost
Last active Apr 8, 2018 — forked from gistwebdev/vhost
Fix for Apache 2.4 (required adding .conf extensions)
View vhost
# Display usage info
vhost-usage() {
cat <<"USAGE"
Usage: vhost [OPTIONS] <name>
-h|--help this screen
-pub to create the webhost root in ~/www/name/public/
-url to specify a local address, default is http://name.local
bgallagh3r / album-lightbox.php
Created Mar 2, 2014
All NextGen Galleries in Lightbox - Loads all galleries on a single page via lightbox instead of going to the actual gallery page. Just add the files appropriately then use this shortcode `[album id=0 template=lightbox]` id of 0 will force NGG to load all galleries. What I did instead however was set the default compact album to use the lightbox…
View album-lightbox.php
// /wp-content/themes/YOURTHEME/nggallery/album-lightbox.php
// To set this theme, go into Gallery > Gallery Settings and change the template to album-lightbox.
Template Page for the album overview
Follow variables are useable :
$album : Contain information about the album