Skip to content

Instantly share code, notes, and snippets.

<?php foreach ( $recipe_vars['instructions'] as $instruction ) { ?>
<p itemprop="recipeInstructions" >
<?php
if ($instruction['image_id'] != ""){
$inst_image = wp_get_attachment_image_src( $instruction['image_id'], "medium", false );
echo "<img src='{$inst_image[0]}' style='float:left;' /> ";
}
if (count($instruction['text']) > 1 ) {
echo '<ol>';
foreach ($instruction['text'] as $numbered_inst ){
@joeyblake
joeyblake / gist:2854349
Created June 1, 2012 18:50 — forked from coreyweb/gist:2718955
WordPress Popular Comments
<?php
/**
* Display a list of the 10 most commented posts (WordPress)
* @author Corey Brown https://github.com/coreyweb
* @author Aaron Collegeman: https://github.com/collegeman
* @author Joey Blake: https://github.com/joeyblake
*
* Rules:
* - show a list of 10 posts
* - published any time
@joeyblake
joeyblake / gist:7993402
Created December 16, 2013 20:04
SharePress facebook cache bypass filter
add_filter('sp_auto_flush_fb', '__return_false');
@joeyblake
joeyblake / r-debug.php
Created May 17, 2017 15:40 — forked from Rarst/r-debug.php
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: http://www.rarst.net/
License: MIT
*/
/**
@joeyblake
joeyblake / .gitignore
Created October 10, 2017 13:29 — forked from salcode/.gitignore
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@joeyblake
joeyblake / hostfix
Created February 27, 2012 16:13
Shell script for cleaning/resetting /etc/hosts files messed up by MAMP Pro
#!/bin/bash
# copy this file to /usr/sbin
# if you have other hosts entries that you would not like to lose, make sure they get added to the hosts.mamp.bak file
cat /etc/hosts.mamp.bak > /etc/hosts
echo 'clean!'
@joeyblake
joeyblake / gist:11402110
Created April 29, 2014 14:30
Redirect all subdomains to main domain: ExpressJS/Ghost
/*
* redirect all subdomains example
* example domain name testsite.com
*/
// split the incoming host to get the first element
var incoming = req.headers.host.split('.')[0];
// check if it matches your domain
if ( incoming !== 'testsite' ) {

Keybase proof

I hereby claim:

  • I am joeyblake on github.
  • I am joeyblake (https://keybase.io/joeyblake) on keybase.
  • I have a public key whose fingerprint is DE24 0AE3 4CCD 38A5 2BF6 CF41 96F2 ADE8 0680 4686

To claim this, I am signing this object:

@joeyblake
joeyblake / .htaccess
Created December 11, 2019 21:54
WordPress cache enabler plugin
# BEGIN Cache Enabler
#
# This version is meant for Apache 2.3.9 or later.
#
# Reference: https://www.keycdn.com/support/wordpress-cache-enabler-plugin#apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# set blog sub path
//row markup
$row = '<div class="row-fluid">%s</div>'
//$posts = whatever you are trying to put in a grid.
$span_divs = array();
foreach ( $posts as $post ) {
//make a span box
$span_divs[] = sprintf( "<div class="span4">%s</div>" , $post);
}
//chunk the array of grid items into a number if items