Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@oneblackcrayon
oneblackcrayon / add-last-modified-date-to-pages-in-wordpress.php
Created February 24, 2016 21:46
Add last modified date to pages in WordPress
add_filter( 'manage_edit-page_columns', 'aco_last_modified_admin_column' );
// Create the last modified column
function aco_last_modified_admin_column( $columns ) {
$columns['modified-last'] =__( 'Last Modified', 'aco' );
return $columns;
}
add_filter( 'manage_edit-page_sortable_columns', 'aco_sortable_last_modified_column' );
@oneblackcrayon
oneblackcrayon / Install Composer to use MAMP's PHP.md
Created February 16, 2016 18:37 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

function my_assets() {
wp_register_script( 'owl-carousel', get_stylesheet_directory_uri() . '/owl.carousel.js', array( 'jquery' ) );
wp_enqueue_script( 'owl-carousel' );
}
add_action( 'wp_enqueue_scripts', 'my_assets' );
// You must run *3* commands to make this work!
export ENV=dev <--- run this to choose the environment
# Usually dev, test, or live
export SITE=<this is a string of numbers and letters with dashes - the UUID> <--- run this to tell the command what the environment is
# Site UUID from dashboard URL: https://dashboard.pantheon.io/sites/<UUID>
# To Upload/Import
rsync -rlvz --size-only --ipv4 --progress -e 'ssh -p 2222' ./files/* --temp-dir=../tmp/ $ENV.$SITE@appserver.$ENV.$SITE.drush.in:files/
@oneblackcrayon
oneblackcrayon / dynamic-copyright-WP.md
Created January 28, 2016 20:56 — forked from jekkilekki/dynamic-copyright-WP.md
Creating a Dynamic Copyright in WordPress
@oneblackcrayon
oneblackcrayon / wp-config.php
Created January 28, 2016 04:49
WordPress: Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@oneblackcrayon
oneblackcrayon / wp.sh
Created January 28, 2016 00:04 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser
<?php
global $ld_recalc;
$ld_recalc = array(
'posts_per_run' => 16,
'post_types' => array( 'bowtech_distributor' ),
'scan_key' => 'acf-recalc-scan',
'scan_identifier' => '2015-09-23', // Change this if you want to scan again in the future.
@oneblackcrayon
oneblackcrayon / apps.sh
Created January 24, 2016 22:25 — forked from ibanez270dx/apps.sh
Fresh OSX setup
#!/bin/sh
# First install homebrew and cask
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install cask brew-cask
# Applications
brew cask install 1password
brew cask install anvil
brew cask install atom
@oneblackcrayon
oneblackcrayon / fix-homebrew-npm.md
Created January 20, 2016 18:06 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g