Skip to content

Instantly share code, notes, and snippets.

View whyisjake's full-sized avatar
✈️

Jake Spurlock whyisjake

✈️
View GitHub Profile
@whyisjake
whyisjake / tax.php
Created July 27, 2011 18:41
Taxonomy Conditionals for WordPress
<?php //add this to your functions.php file ?>
<?php
//hook into the init action and call create_maker_taxonomies when it fires
add_action( 'init', 'create_maker_taxonomies', 0 );
//create maker taxonomy for the post type "post"
function create_maker_taxonomies()
{
@whyisjake
whyisjake / js_excerpt
Created October 22, 2011 04:00
Simple function to limit the length of an excerpt.
<?php
//To use, just call <?php js_excerpt(Charecters that you want); ?> in your theme. Add this bit here to your functions.php file.
function js_excerpt($length){
echo substr(get_the_excerpt(), 0, $length);
}
?>
@whyisjake
whyisjake / make_youtube_embed()
Created October 22, 2011 04:11
Simple YouTube Embederator
<?php
function make_youtube_embed($width,$height) {
global $wp_query;
$big_video = get_post_custom_values('Big Video');
?>
<object width="<?php echo $width; ?>" height="<?php echo $height; ?>">
<param name="movie" value="http://www.youtube-nocookie.com/v/<?php echo $big_video[0]; ?>?showinfo=1&version=3&amp;hl=en_US&amp;hd=1"></param>
@whyisjake
whyisjake / gist:1310481
Created October 24, 2011 22:05
PHP Array
["child"]=>
array(1) {
["http://www.w3.org/2005/Atom"]=>
array(7) {
["title"]=>
array(1) {
[0]=>
array(5) {
["data"]=>
string(21) "Make: Deal of the Day"
@whyisjake
whyisjake / jQuery with a PHP array...
Created October 26, 2011 23:48
Looking for an easy way to load a php array into some jQuery... Any ideas on how to simplify this?
<script>
<?php $arr = array(185,4,171); ?>
$(document).ready(function(){
/* Put your jQuery here */
$('.post-4').hide();
$('.post-171').hide();
$('.click185').addClass('active');
@whyisjake
whyisjake / gist:1339520
Created November 4, 2011 15:03
Super/Sub Script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
<meta name="generator" content="BBEdit 10.1" />
</head>
<body>
<h1>Super and Subs</h1>
@whyisjake
whyisjake / single.php
Created November 4, 2011 18:12
WordPress Conditional for Gallery
<?php get_header(); ?>
<div class="row">
<?php
global $wp_query;
$postid = $wp_query->post->ID;
$big_video = get_post_custom_values('Big Video');
@whyisjake
whyisjake / foreach.php
Created November 9, 2011 04:22
foreach in a foreach
<?php
$json = file_get_contents('http://makeprojects.com/api/0.1/guide/1019');
$json_output = json_decode($json);
$steps = $json_output->guide->steps;
foreach ($steps as $step) {
echo '<div>';
echo $step->title;
$images = $json_output->guide->steps->images;
@whyisjake
whyisjake / foreach.php
Created November 9, 2011 06:23
foreach in a foreach
<?php
$json = file_get_contents('http://makeprojects.com/api/0.1/guide/1019');
$json_output = json_decode($json);
//print_r(json_decode($json));
@whyisjake
whyisjake / gist:1363050
Created November 14, 2011 01:48
For Each
<?php get_header(); ?>
<div class="row">
<?php
global $wp_query;
$postid = $wp_query->post->ID;
$big_video = get_post_custom_values('Big_Video');