Skip to content

Instantly share code, notes, and snippets.

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

Stephen Edgar ntwb

🏠
Working from home
View GitHub Profile
@norcross
norcross / remove-avatar-user-table.php
Created March 28, 2016 19:52
Remove user avatars from the admin user table
<?php
add_filter( 'pre_get_avatar', 'rkv_remove_avatar_from_list', 10, 3 );
/**
* Remove the avatars from just the admin user list table.
*
* @param string $avatar HTML for the user's avatar. Default null.
* @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
* @param array $args Arguments passed to get_avatar_url(), after processing.
*
@josheby
josheby / .htaccess
Created March 14, 2016 23:15
Nested WordPress Networks Using WP Multi Network
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)+?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
@trilodge
trilodge / Gruntfile.js
Last active May 17, 2017 08:07
Grunt Setup of Stylelint linting SCSS-Files based on postcss-scss and postcss-reporter
var path = require('path');
var fs = require('fs');
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@jazzsequence
jazzsequence / update.sql
Created February 12, 2016 21:24
Update wp_postmeta and wp_posts database tables with posts from another site
# What if you are trying to migrate a bunch of posts from one site into
# another site that already has content? We'll assume you already have
# a database export of the posts and postmeta you want to migrate. You
# will want to create a database locally to alter the tables to get them
# ready to merge into the production database that already has content.
# You will also need to know the highest `meta_id` and `ID` values from
# the `wp_postmeta` and `wp_posts` tables, respectively.
# First, we need to create new columns in the tables we have locally. To
# do this the right way, we are going to figure out what type of data
@chrisui
chrisui / button.jsx
Created February 11, 2016 14:21
cx .undefined
import cx from 'classnames';
import styles from './button.css';
const Button = ({children}) => (
<button className={cx({[styles.button]: true})}>{children}</button>
);
// If we didn't define .button inside button.css then the above cx call
// looks like cx({[undefined]: true}) which actually means the class name
// "undefined" is set.
@Clorith
Clorith / plugin.php
Created December 11, 2015 15:22
Encourage your users to submit translations for your WordPress plugin
<?php
function language_detector_admin_notices() {
// Get the current language locale
$language = get_locale();
// Check if the nag screen has been disabled for this language
if ( false === get_option( 'plugin_slug_language_detector_' . $language, false ) ) {
// Check if a translation file already exists for this language
if ( $loaded = load_plugin_textdomain( 'text_domain', false, plugin_dir_path( __FILE__ ) . '/languages/' ) ) {
@jeremyfelt
jeremyfelt / cli.ini
Created November 13, 2015 03:07
Let's Encrypt Configuration
# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Let's Encrypt with
# "--help" to learn more about the available options.
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# Always use the staging/testing server
# server = https://acme-staging.api.letsencrypt.org/directory
server = https://acme-v01.api.letsencrypt.org/directory
sudo: false
language: php
matrix:
include:
- php: 5.6
before_install:
- WP_CORE_DIR=/tmp/wordpress/
- git clone https://github.com/WordPress/twentysixteen.git src/wp-content/themes/twentysixteen
- |
if [[ true ]]; then
@thibmaek
thibmaek / nvmi.sh
Last active June 22, 2017 22:49
Update node with nvm, migrating global modules
# Usage: nvmi v6.0.1 (will install specified version)
# Usage: nvmi_latest (will install latest node version)
# these functions will replace the current 'default' version known in the shell.
# to install a node version next to your current 'default' just use nvm install vX.X.X
function nvmi() {
CURRENT=$(node -v)
nvm install $1 --reinstall-packages-from=$CURRENT
@johnbillion
johnbillion / wp_mail.md
Last active May 12, 2024 14:19
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail