Skip to content

Instantly share code, notes, and snippets.

View coreyweb's full-sized avatar

corey brown coreyweb

View GitHub Profile
<?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>
@coreyweb
coreyweb / wp_table-shortcode.php
Last active January 3, 2016 07:28
WordPress Table Shortcode
<?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 ) {
@coreyweb
coreyweb / wp_check_post_date
Created January 19, 2014 14:58
Check post date in a WordPress post and establish rules for before and after a certain date
<?php
if (strtotime($post->post_date) > strtotime('January 01 2014')) {
// this is a newer post
} else {
// this is an older post
}
?>
<!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="">
<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) {
?>
<!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 -->