Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
woodwardtw / loop for pre_post
Created March 17, 2014 01:38
add numbers per loop
<script type="text/javascript">
$(function(){
<?php
foreach ($responses as $i => $row)
{
if ($isFirst) {
$isFirst = false;
continue;
}
$isLast = ($i == $last);
@woodwardtw
woodwardtw / Google Map Marker LatLong
Last active April 25, 2023 13:16
A draggable Google Map marker that auto locates and updates on maker drag
<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0px;
@woodwardtw
woodwardtw / gist:b90ff5b83d4d86e18cfe
Created December 11, 2014 19:46
wordpress plugin to allow Google Drive embeds via the URL ID
<?php
/**
* Plugin Name: Embed UR Google Drive Folder w the unique URL ID
* Plugin URI: http://bionicteaching.com
* Description: Allows an embed of the Google Drive Folder via the unique ID
* Version: .9
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: A "Slug" license name e.g. GPL2
*/
@woodwardtw
woodwardtw / get post content to gravity form field
Last active August 29, 2015 14:11
This is put in the functions.php file of the theme and pulls the content of the post that the form is in to dynamically populate a specific GF field.
//points to the gform field where you've named the variable post_body
add_filter('gform_field_value_post_body', 'populate_post_body');
//fills the post_body variable with the value found in get_the_content
function populate_post_body($value){
global $post;
$post_body = get_the_content();
return $post_body;
}
@woodwardtw
woodwardtw / gist:d9c4ddcbaac1d085c555
Last active August 29, 2015 14:15
masonry display for tutorial
<div id="masonry-container">
[display-posts category="photography" image_size="medium" posts_per_page="22" wrapper=div]
</div>
[row]
[column md="1"][/column]
[column md="5"]
[well size="sm"]
<h2>Examples by Discipline</h2>
[facetwp facet="discipline"]
[facetwp template="motherblog"]
[/well]
[/column]
function add_addthisevent() { //make a function
wp_enqueue_script( 'add_this_event', //name it
'https://addthisevent.com/libs/1.5.8/ate.min.js', //point to the script you want to enqueue
'1.5.8', //what version is the script
true); //true puts it in the footer and false puts it in the header
}
add_action( 'wp_enqueue_scripts', 'add_addthisevent' );
@woodwardtw
woodwardtw / gist:252b6d671f3728506f0b
Created March 20, 2015 12:34
basic plugin for addthisevent.com with detailed comments
<?php
/**
* Plugin Name: Add This Event JS.
* Plugin URI: https://addthisevent.com/
* Description: Simply adds the addthisevent.com js to the footer.
* Version:1.0.0
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
@woodwardtw
woodwardtw / gist:9fc56df4baef68b341bd
Last active August 29, 2015 14:22
get gravatar image in FacetWP for OLE site
<?php
while (have_posts()):
the_post();
?>
<?php
if (get_post_meta(get_the_ID(), 'gravatar_email', true)):
?>
<div class="person">
<?php
$gravy = get_post_meta(get_the_ID(), 'gravatar_email', true);
<?php
$search = 'ecig';
$url = 'https://api.instagram.com/v1/tags/' . $search .'/media/recent?client_id=YOUR_CLIENT_ID_HERE';
$json = file_get_contents($url);
$obj = json_decode($json);
date_default_timezone_set('EST');
$list = array();
foreach ($obj->data as $media) {
$username = $media->user->username;