Skip to content

Instantly share code, notes, and snippets.

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 Sep 9, 2011
Mass Price Update for Shopp
View voc_priceeditor.php
<?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 Oct 24, 2011
Aweber Opt-in Widget
View aweber_widget.php
<?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 );
}
View admin_htaccess.txt
# custom login link
RewriteRule ^login$ http://localhost/whitelabel/wp-login.php [NC,L]
View rkv-admin-style.css
@charset "utf-8";
/* CSS Document */
html, body {
height: 100%;
}
html {
background-color: #fff;
}
body.login {
background:#1D2736;
@norcross
norcross / gist-sidebar-widget
Created Dec 24, 2011
Public Gist Sidebar Widget
View 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 Jan 23, 2012
Favorite Tweets widget
View 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 Mar 30, 2012
Fix curly quotes on post save and display
View rkv_no_curly_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 Mar 30, 2012
Add referring site to Gravity Forms
View rkv_referr_source
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 Apr 1, 2012
Convert date entry to UNIX timestamp
View rkv_date_convert
// 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 Oct 3, 2015
Wrap print_r in a 'pre' tag
View pre-debug.php
<?php
function preprint($s, $return = false) {
$code = '<pre>';
$code .= print_r($s, 1);
$code .= '</pre>';
if ($return)
return $code;
else
print $code;
}