Skip to content

Instantly share code, notes, and snippets.

Travis Northcutt tnorthcutt

Block or report user

Report or block tnorthcutt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshuadavidnelson
joshuadavidnelson / gravity-form-cmb2-options.php
Last active Aug 5, 2018
A function to return an array of gravity forms for a CMB2 select field.
View gravity-form-cmb2-options.php
<?php
/**
* Get an array of gravity forms.
*
* @since 1.0.0
*
* @return void
*/
function jdn_gf_options() {
$form_array = array();
@mgratch
mgratch / RCP_login_redirect.php
Created May 8, 2015
Automatically redirect users to where they came from upon logging in and out. Warning this does cause a problem when logging out from a restricted content page.
View RCP_login_redirect.php
<?php
function mg_rcp_hijack_login_url() {
global $rcp_options;
if( isset( $rcp_options['login_redirect'] ) ) {
$login_url = get_the_permalink( $rcp_options['login_redirect'] );
}
return $login_url;
}
@pjrvs
pjrvs / newslettercookie.html
Last active Nov 7, 2017
a jquery cookie that shows a signup form for people that aren't signed up and an alternate message for people that came from the list or signed up.
View newslettercookie.html
<!DOCTYPE html>
<html>
<head>
<title>jQuery Cookie + MailChimp</title>
<meta charset="utf-8">
</head>
<body>
<form action="XXX" method="post" class="signup">
View VagrantXDebug.md

Configure

xdebug.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
@pippinsplugins
pippinsplugins / gist:11402562
Last active Oct 14, 2018
Custom user fields for Restrict Content Pro
View gist:11402562
<?php
/*
Plugin Name: Restrict Content Pro - Custom User Fields
Description: Illustrates how to add custom user fields to the Restrict Content Pro registration form that can also be edited by the site admins
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Dec 7, 2019
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

View functions.php
<?php
function be_custom_loop() {
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
$classes = 0 == $loop->current_post || 0 == $loop->current_post % 2 ? 'one-half first' : 'one-half';
echo '<div class="' . $classes . '">' . get_the_title() . '</div>';
endwhile; endif; wp_reset_postdata();
}
@thomasgriffin
thomasgriffin / gist:8012662
Last active Dec 31, 2015
REMOVE ALL THE METABOXES FROM ALL THE THINGS. WARNING: THIS THING IS VERY AGGRESSIVE.
View gist:8012662
<?php
add_action( 'add_meta_boxes', 'tgm_remove_all_the_metaboxes', 100 );
/**
* Removes all metaboxes except the ones I WANT ON MY POST TYPE. RAGE.
*
* This assumes a specific post type. In my case, it is 'envira'.
* This function is very aggressive and removes every single metabox minus
* the needed submitdiv metabox (which allows you to publish something) and
* the metaboxes that I register with my plugin.
*
@norcross
norcross / norcross-debug-functions.php
Last active Aug 6, 2019
my list of debugging functions to keep in an MU file
View norcross-debug-functions.php
<?php
/*
Plugin Name: Norcross Debug Functions
Plugin URI: https://gist.github.com/norcross/7864205/
Description: A set of functions I use on all sites while building
Author: Andrew Norcross
Version: 0.0.1
Requires at least: 3.0
Author URI: http://andrewnorcross.com
*/
You can’t perform that action at this time.