This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<title>iTunes Album Playlist</title> | |
<!-- Bootstrap --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<h3>My Pictures</h3> | |
<?php | |
$json = file_get_contents('https://api.instagram.com/v1/users/[YOUR_USER_ID]/media/recent?access_token=[YOUR_ACCESS_TOKEN]&count=5'); | |
$data = json_decode($json); | |
foreach ($data->data as $key=>$value) { | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<meta name="description" content=""> | |
<meta name="keywords" content=""> | |
<meta name="author" content=""> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (strtotime($post->post_date) > strtotime('January 01 2014')) { | |
// this is a newer post | |
} else { | |
// this is an older post | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this shortcode allows you to add multiple rows and columns in a table | |
// corey modified from this from a shortcode found here: | |
// http://wpsnipp.com/index.php/functions-php/shortcode-tables-with-multiple-rows-and-columns/ | |
// example shortcode: | |
// [specs cols="2" data="Row1 Item1:|Row1 Item2|Row2 Item1:|Row2 Item2"] | |
// (define # of columns in 'cols' and place your contents in 'data' with a delimiter) | |
// markup is Bootstrap | |
function specs_list( $atts ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ($feed = coreylib('http://api.bigcartel.com/notreble/products.xml','10 minutes')) { ?> | |
<?php foreach($feed->get('product') as $product) { ?> | |
<p><strong>URL: </strong> http://shop.notreble.com<?php echo $product->get('url') ?></p> | |
<p><strong>Item name: </strong> <?php echo $product->get('name') ?></p> | |
<p><strong>Item image: </strong> <?php echo $product->get('image/url') ?></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Soundcloud has a shortcode for WordPress.com, | |
// but it doesn't work on self-hosted WordPress sites. | |
// To make the standard shortcode work, add this to your functions.php file. | |
// Here is what Soundcloud's "WordPress Code" shortcode looks like: | |
// [soundcloud url="http://api.soundcloud.com/tracks/95232600" params="" width=" 100%" height="166" iframe="true" /] | |
function soundcloud( $atts, $url='' ) { | |
extract(shortcode_atts(array( | |
'url' => 'http://', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Convert URL's with protocol prefix | |
$tweet = ereg_replace("[a-zA-Z]+://([-]*[.]?[a-zA-Z0-9_/-?&%])*", "<a href=\"\\0\">\\0</a>", $tweet); | |
//Convert URL with just www. | |
$tweet = ereg_replace("(^| |\n)(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://\\2\">\\2</a>", $tweet); | |
//Convert # hashtags | |
$tweet = ereg_replace("(^| |\n)(\#([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://search.twitter.com/search?q=\\2\">\\2</a>", $tweet); | |
$tweet = str_replace("/#", "/", $tweet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Resize images dynamically using wp built in functions. | |
* @author Victor Teixeira http://profiles.wordpress.org/vteixeira/ | |
* @author Aaron Collegeman http://aaroncollegeman.com | |
* @see http://core.trac.wordpress.org/ticket/15311 | |
* | |
* @coreyweb's note: I asked Aaron to simplify Victor's original by excluding | |
* the lookup to see if the original image is big enough to render the newly sized image. | |
* Our themes don't increase image sizes (ever), and if they did, they would |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
Get a list of all pages on a site, by their template name. | |
This is useful in determining which custom page templates are in use (and the reverse: which are not) | |
source: Jorge Pedret | |
http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/ | |
*/ |
NewerOlder