Skip to content

Instantly share code, notes, and snippets.

View norcross's full-sized avatar

Norcross norcross

View GitHub Profile
@norcross
norcross / sharedaddy-css.css
Created April 14, 2014 12:31
CSS fixes for Sharedady to account for RWD
/** ShareDaddy
* ----------------------------------------------------------------------------
*/
body.custom .entry-content div.sharedaddy {
margin: 20px 0 0;
}
body.custom .entry-content div.sharedaddy .sd-block {
border-top: 1px dotted #ccc;
@norcross
norcross / custom-menu-order.php
Created February 19, 2014 21:17
set custom menu order
<?php
add_filter ( 'custom_menu_order', array( $this, 'menu_order' ), 1001 );
add_filter ( 'menu_order', array( $this, 'menu_order' ), 1001 );
public function menu_order( $menu_ord ) {
if ( ! $menu_ord )
return true;
return array(
@norcross
norcross / structure-redirects.php
Created February 4, 2014 16:08
set up 404 redirects from /%postname%/ to /blog/%category%/%postname%/
<?php
/** set up redirects from old structure */
function aly_post_redirects() {
if ( ! is_user_logged_in() )
return;
if ( is_404() ) :
$slug = $_SERVER['REQUEST_URI'];
<?php
echo '<tr class="addon-file-field">';
echo '<th>';
echo '<label for="addon-file">'.__( 'ZIP file', '' ).'</label>';
echo '</th>';
echo '<td>';
echo '<input type="text" name="addon-meta[file]" id="addon-file" class="widefat" value="'.esc_url( $file ).'">';
echo '</td>';
echo '</tr>';
@norcross
norcross / bootstrap-cdn-item.php
Created January 8, 2014 18:06
load Bootstrap CDN items
<?php
add_action ( 'wp_enqueue_scripts', 'bootstrap_cdn_scripts_styles', 10 );
function bootstrap_cdn_scripts_styles() {
wp_enqueue_style( 'bootstrap-css', '//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css', array(), '3.0.3', 'all' );
wp_enqueue_script( 'bootstrap-js', '//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js', array(), '3.0.3', true );
}
@norcross
norcross / gppro-preview-view.php
Created January 4, 2014 23:36
load the preview in logged in mode
<?php
add_filter( 'gppro_preview_url', 'gpp_user_logged_in' );
function gpp_user_logged_in( $url ) {
$url['adminbar'] = 'on';
return $url;
}
@norcross
norcross / cheddar-bay
Created December 28, 2013 01:37
recipe for cheddar bay biscuits
* 2 C. Bisquick
* 2/3 C. milk
* 1/2 C. shredded Cheddar Cheese
* 1/2 C. butter melted
* 1/4 tsp. dried parsley
* 1/4 tsp. garlic powder
Preparation -
Mix bisquick, milk and cheese together to form a soft biscuit dough.
@norcross
norcross / norcross-debug-functions.php
Last active May 21, 2025 13:15
my list of debugging functions to keep in an MU file
<?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.2
Requires at least: 6.0
Author URI: http://andrewnorcross.com
*/
@norcross
norcross / gist:7797374
Created December 4, 2013 23:17
WP Color Picker implentation
// **************************************************************
// bind Iris to color picker input
// **************************************************************
$( 'input.gppro-picker' ).each(function() {
var block = $( this ).parents( 'div.gppro-input' );
var target = $( block ).find( 'input.gppro-color-value' ).data( 'target' );
var type = $( block ).find( 'input.gppro-color-value' ).data( 'type' );
var view = $( block ).find( 'input.gppro-color-value' ).data( 'view' );
@norcross
norcross / states-drop-array.php
Last active April 13, 2016 15:18
dropdown array of states in PHP
<?php
/**
* set up dropdown for states
*
* @return states
*/
static function states_select( $name = 'niica_member_state', $user_id = 0 ) {
// fetch the current status