Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
View jquery.fullscreenr.js
/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* www.nanotux.com
*
* Modifications by Chris Van Patten
* http://www.vanpattenmedia.com
* Version 1.5
**/
@chrisvanpatten
chrisvanpatten / plugin.php
Created Mar 3, 2012
admin_enqueue_scripts
View plugin.php
<?php
/**
*
* admin_enqueue_scripts is the preferred hook[1] for adding style to the admin, but
* documentation is frankly sparse and a bit confusing, especially for beginners.
*
* This gist has everything you need to load style for a plugin directly to a hook
* of your choice. Enjoy!
*
@chrisvanpatten
chrisvanpatten / README.md
Created Mar 7, 2012
WordPress Admin Tabs
View README.md

Huh?

Believe it or not, WordPress doesn't have a fully-fleshed out common tab style for plugins or theme authors to use in metaboxes.

The style exists for categories, but it hasn't been fully adapted for the half-complete wp-tab setup. Trac ticket #17959 has a solution that not only fleshes the style but it also adds a global JavaScript file to give the wp-tab HTML some action. Until that ticket is accepted into core, this Gist adapts that code so it's available to use independently in your theme or plugin.

How?

Just enqueue the CSS and JavaScript in the admin_enqueue_scripts script hook and drop the tab HTML in a metabox. It will automatically adapt to the normal and side column widths, much like category tabs.

View wp-config.php
<?php
//...
$urlParts = explode('.', $_SERVER['HTTP_HOST']);
if ($urlParts[0] == 'staging') {
// Do some stuff if we're on staging
define('WB_DEBUG', true);
// I want to rewrite the site_url and home_url here
@chrisvanpatten
chrisvanpatten / title-tag.php
Created Apr 1, 2012 — forked from nacin/title-tag.php
Replacement for wp_title()?
View title-tag.php
<?php
// In a theme:
add_action( 'after_setup_theme', function() {
add_theme_support( 'title-tag', array( 'option' => true ) );
} );
// In core:
add_action( 'wp_head', '_wp_render_title_tag' );
function _wp_render_title_tag() {
View index.php
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<?php get_template_part('head'); ?>
<body <?php body_class(); ?>>
<?php get_header(); ?>
View base.php
<?php $base = theme_template_base(); ?><!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<?php get_template_part('head'); ?>
<body <?php body_class(); ?>>
<div id="wrap">
<div id="content-top"></div>
@chrisvanpatten
chrisvanpatten / README.md
Created May 7, 2012
Awesome CSS3 buttons with Compass and Sass
View README.md

Awesome CSS3 buttons with Compass and Sass

This is a mixin I built for quick CSS3 buttons on the new VanPattenMedia.com. It's designed to be very flexible, and has a lot of options so you can customize it quickly and easily.

Documentation

Defaults are in bold, if they exist.

@include vpm-button($background-color, $text-color, $state, $spread, $radius);

@chrisvanpatten
chrisvanpatten / gitpushguide.md
Created May 13, 2012
Git push for website publication
View gitpushguide.md

This tutorial walks you through the process of setting up git so you can easily push to staging and production remotes.

Expectations

You should have a local development copy of your website (located anywhere) and staging and production websites in the same directory on your remove server; e.g. two directories named staging.website.com and website.com.

You can certainly locate them anywhere you want (just change the path to the remotes in step three) but I'm not planning for that in this guide.

Step one: initialization/setup

View chirp.rb
get '/login' do
openid_user = get_user(params[:token])
user = User.first_or_create(
:identifier => '123456',
:email => 'chris@vanpattenmedia.com',
:nickname => 'Chris',
:photo_url => 'http://blah.com/cvp'
)
end
You can’t perform that action at this time.