Skip to content

Instantly share code, notes, and snippets.

View MikeGillihan's full-sized avatar
🏠
Working from home

Mike Gillihan MikeGillihan

🏠
Working from home
View GitHub Profile
@BjornW
BjornW / Setup WordPress Multi-tenant infrastructure
Last active March 16, 2021 04:54
A short description of how I've setup a WordPress Multi-Tenant architecture. This is based on the excellent post by Jason McCreary http://jason.pureconcepts.net/2013/04/updated-wordpress-multitenancy/ and the great ascii art explanations by Wes Koop (https://gist.github.com/weskoop/3796570) & Mark Jaquith (https://gist.github.com/markjaquith/622…
I'm using Ubuntu 12.04 and I'm following the Debian/Ubuntu way of dealing with config files. I presume you know how to work with sudo and such
- Install last stable version of WordPress (in my case 3.6) with Subversion into /opt/wordpress/3.6
- create a symlink /opt/wordpress/stable ==> /opt/wordpress/3.6
- create a directory sites in /var/www/sites
- create a directory specific for your site using the domain name e.g. /var/www/sites/example.com
- create a directory wp-content in /var/www/sites/example.com
- create a directory wordpress in /etc
- create a directory named as you site's domain name, e.g. in /etc/wordpress
- copy from /opt/wordpress/stable/wp-config-sample.php to /etc/wordpress/example.com/wp-config.php
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
// --------------------------------------------------------------------------------------
// A More Modern Scale for Web Typography
// Based on this article: http://typecast.com/blog/a-more-modern-scale-for-web-typography
// --------------------------------------------------------------------------------------
$body-font-size: 1em !default;
// Adjusts body typography to be default
// for each browser.
@mixin reset-body-font-size($font-size: 100%, $size-adjustment: 0.5) {
@norcross
norcross / bypass-auto-update-email.php
Last active August 29, 2015 14:04
Disable the email notification for successful update
<?php
function rkv_bypass_auto_update_email( $send, $type, $core_update, $result ) {
// check our type and bail if successful
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
// return the send function
return true;
@logoscreative
logoscreative / functions.php
Created January 24, 2015 19:05
Hook Gravity Forms Submission Into Events Calendar Pro
/* Make Events Form Work Redux */
add_filter("gform_post_data", "mb_set_post_date", 10, 3);
function mb_set_post_date($post_data, $form, $entry){
if($form["id"] != 48)
return $post_data;
$startdate = $entry["69"];
$starttime = $entry["5"];
@salcode
salcode / .gitignore
Last active February 19, 2025 22:44
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@jemoreto
jemoreto / multiple-roles-per-user.php
Created May 15, 2015 19:45
Multiple roles per user WordPress plugin. Working when creating a new user and editing an user. Thanks to nikolov-tmw (https://goo.gl/Xv563d) and evankennedy (https://goo.gl/sh2sX6).
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
Copyright 2013 Nikola Nikolov (email: [email protected])

Deploy your site with git securely

This gist assumes:

  • you have a local git repo
  • you have an online remote repository (github)
  • you have a server running Apache with git already installed

you should be able to do the same with Java, Perl, RoR, JSP etc. however you'll need to recreate the (rather simple) PHP script

@bwhli
bwhli / Redirect WordPress Logout to Home Page
Created July 7, 2015 04:54
Redirect WordPress Logout to Home Page
//* Redirect WordPress Logout to Home Page
add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));
@kjbrum
kjbrum / WordPress Setup Script.md
Last active March 10, 2018 18:31
Easily set up a project with a Bitbucket repository, ServerPilot application, base plugin and theme, as well as run miscellaneous WordPress tasks.

WordPress Setup Script

Easily set up a project with a Bitbucket repository, ServerPilot application, base plugin and theme, as well as run miscellaneous WordPress tasks. Should be used with https://github.com/Mixd/wp-deploy.

Step 1: Setup project

# Enter your project directory
cd your/desired/project/directory