Skip to content

Instantly share code, notes, and snippets.

View jlittlejohn's full-sized avatar

Josh Littlejohn jlittlejohn

View GitHub Profile
@jlittlejohn
jlittlejohn / WP: Login Logic
Created September 12, 2012 13:40
WP: Login Logic
<?php
// is the user logged in?
if (is_user_logged_in()) {
// you could also add other parameters here to limit who has access to the page:
// if (is_user_logged_in() && is_author()) {
?>
<!-- Code here -->
<?php
@jlittlejohn
jlittlejohn / PHP: Testing Data Types
Created September 13, 2012 22:12
PHP: Testing Data Types
array: <?php echo is_array($var); ?><br>
boolean: <?php echo is_bool($var); ?><br>
float: <?php echo is_float($var); ?><br>
integer: <?php echo is_int($var); ?><br>
null: <?php echo is_null($var); ?><br>
number: <?php echo is_numeric($var); ?><br>
string: <?php echo is_string($var); ?><br>
@jlittlejohn
jlittlejohn / WP: header.php (The Works)
Created September 17, 2012 01:08
WP: header.php (The Works)
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php wp_title( '|', true, 'right' ); ?> <?php $site_title = get_bloginfo('name'); ?><?php echo get_bloginfo ('name'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@jlittlejohn
jlittlejohn / WP: Query Database
Created September 26, 2012 16:29
WP: Query Database
<?php
$args = array(
'post_type' => 'slide-show',
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'slide-show-category',
@jlittlejohn
jlittlejohn / PHP: Set Cookie
Created September 28, 2012 01:46
PHP: Set Cookie
@jlittlejohn
jlittlejohn / PHP: Retrieve Cookie
Created September 28, 2012 02:25
PHP: Retrieve Cookie
@jlittlejohn
jlittlejohn / PHP 302 Redirect
Created September 28, 2012 02:46
PHP: 302 Redirect
<?php
header("Location: destination.php");
exit;
?>
@jlittlejohn
jlittlejohn / JS: jQuery Plugin Boilerplate
Created October 1, 2012 16:30
JS: jQuery Plugin Boilerplate
// jQuery Plugin Boilerplate
// A boilerplate for kick-starting jQuery plugins development
// version 1.3, May 07th, 2011
// by Stefan Gabos
// with help from Roger Padilla, Shinya, JohannC, Steven Black, Rob Lifford
// remember to change every instance of "pluginName" to the name of your plugin!
(function($) {
// here it goes!
@jlittlejohn
jlittlejohn / WP Copyright Info
Created October 4, 2012 04:49
WP: Copyright Info
@jlittlejohn
jlittlejohn / HTML: Address
Created October 5, 2012 14:42
HTML: Address
<address itemtype="http://schema.org/PostalAddress" itemscope="">
<span itemprop="streetAddress">Street Address</span><br>
<span itemprop="addressLocality">City</span>, <span itemprop="addressRegion">STATE</span> <span itemprop="postalCode">ZipCode</span>
</address>