Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View norcross's full-sized avatar
somone said this would be easy. someone LIED.

Norcross norcross

somone said this would be easy. someone LIED.
View GitHub Profile
@norcross
norcross / voc_priceeditor.php
Created September 9, 2011 20:30
Mass Price Update for Shopp
<?php
function vol_price_css() {
$theme_dir = get_bloginfo('template_directory');
?>
<style type="text/css">
.shopp h2.voc_title {padding: 12px 15px 25px 0;}
.icon32 {background: url(<?php echo $theme_dir;?>/lib/img/shopp32.png) no-repeat scroll 0 0 transparent;}
.vcc_price_update_btn { position:absolute; top:47px; left:400px;}
table.price-editor tr.headers th{font-weight:bold;}
@norcross
norcross / aweber_widget.php
Created October 24, 2011 20:15
Aweber Opt-in Widget
<?php
/**
* Aweber widget
*/
class aweber_Widget extends WP_Widget {
function aweber_Widget() {
$widget_ops = array( 'classname' => 'aweber', 'description' => 'Displays the aweber opt-in form' );
$this->WP_Widget( 'aweber', 'Aweber Form', $widget_ops );
}
# custom login link
RewriteRule ^login$ http://localhost/whitelabel/wp-login.php [NC,L]
@norcross
norcross / rkv-admin-style.css
Created December 13, 2011 12:29
WP Admin Skin
@charset "utf-8";
/* CSS Document */
html, body {
height: 100%;
}
html {
background-color: #fff;
}
body.login {
background:#1D2736;
@norcross
norcross / gist-sidebar-widget
Created December 24, 2011 03:24
Public Gist Sidebar Widget
<?php
/*
Plugin Name: GitHub Gists Sidebar Widget
Plugin URI: http://andrewnorcross.com/plugins
Description: A sidebar widget to display your public gists from GitHub.
Version: 1.0
Author: norcross
Author URI: http://andrewnorcross.com
*/
/* Copyright 2012 Andrew Norcross
@norcross
norcross / favorite-tweets-widget
Created January 23, 2012 19:40
Favorite Tweets widget
// favorite tweets
class rkv_fav_tweets extends WP_Widget {
function rkv_fav_tweets() {
$widget_ops = array( 'classname' => 'fav_tweets', 'description' => 'Displays tweets favorited by a user' );
$this->WP_Widget( 'fav_tweets', 'Favorite Tweets', $widget_ops );
}
function widget( $args, $instance ) {
extract( $args, EXTR_SKIP );
@norcross
norcross / rkv_no_curly_display
Created March 30, 2012 14:30
Fix curly quotes on post save and display
function rkv_no_curly_display () {
// call the global
global $post;
// get the post content
$content = $post->post_content;
// clean it up
$original = array('“', '”', '’');
@norcross
norcross / rkv_referr_source
Created March 30, 2012 18:00
Add referring site to Gravity Forms
function rkv_referr_source() { ?>
<script type="text/javascript">
// build function for cookie process
function rkv_grab_cookie() {
// check document referrer
if (document.referrer !== '')
var rkv_val = document.referrer;
@norcross
norcross / rkv_date_convert
Created April 1, 2012 17:20
Convert date entry to UNIX timestamp
// Make two admin-only fields (as text fields)
// and post to the custom fields from Gravity Forms
// instead of the "real" date picker.
// NOTE: change the input IDs to match the ones on your form
function rkv_datesubmit_fix ($form){
//event start date field id is 3
//event end date field ID is 4
$raw_srt = $_POST['input_3'];
$raw_end = $_POST['input_4'];
@norcross
norcross / pre-debug.php
Last active October 3, 2015 05:37
Wrap print_r in a 'pre' tag
<?php
function preprint($s, $return = false) {
$code = '<pre>';
$code .= print_r($s, 1);
$code .= '</pre>';
if ($return)
return $code;
else
print $code;
}