Skip to content

Instantly share code, notes, and snippets.

View jamesmehorter's full-sized avatar

James Mehorter jamesmehorter

  • Penske Media Corporation
  • Northport, Maine
View GitHub Profile
<form method="POST" name="wishlist" >
<input type="number" min="0" name="wl_quantity" value="1" />
<input type="hidden" name="wl_product" value="<?php echo $post->ID; ?>" />
<input type="submit" value="<?php printf( __( 'add product') ); ?>" />
</form>
<?php
// If user is logged in and has capability 'read'
if( current_user_can( 'read' ) ) {
// Create the wishlist array
#!/bin/sh
# FuelPHP Install Script
#
# @author Kenji Suzuki https://github.com/kenjis
# @copyright 2011 Kenji Suzuki
# @license MIT License http://www.opensource.org/licenses/mit-license.php
if [ $# -lt 2 ]; then
echo "Install FuelPHP and Create Application Repository"
#!/bin/sh
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]]; then
<?php
/**
* Device Theme Switcher - Load the plugin theme switching functionality
*
* The theme switching utilizes the MobileESP library to detect
* the browser User Agent and determine if it's a 'handheld' or 'tablet'.
* This plugin then taps into the WordPress template and stylesheet hooks
* to deliver the alternately set themes in Appearance > Device Themes.
*
@jamesmehorter
jamesmehorter / page-home.php
Last active August 29, 2015 14:03
Twitter Feed on Website using Twitter OAuth
<?php
$twitter = new Twitter;
$twitter->perform_search("from:UserName OR @UserName OR @UserName", 6);
//We only want to show the social block if there are tweets to show
if (!empty($twitter->search->statuses)) :
?>
<div class="twitter-tweets"><?php foreach ($twitter->search->statuses as $tweet) : //print_r($tweet) ?>
<div class="tweet">
<img class="tweet-profile-image" src="<?php echo $tweet->user->profile_image_url ?>" alt="<?php echo $tweet->user->screen_name ?>" />
@jamesmehorter
jamesmehorter / SCSS
Created July 9, 2014 19:51
Full screen background image(s) -- could be a slideshow
//The slideshow container is positioned below all other content to display like a background image
section.backgrounds {
position: absolute ;
z-index: 0 ;
top: 0 ; left: 0 ;
width: 100% ; height: 100% ;
overflow: hidden !important ; //This keeps the 200% dimensions used below in check and not showing scroll bars
figure.background {
//The following trick is used to display the slideshow slides at the full-width of the screen
@jamesmehorter
jamesmehorter / gist:d20b6623e6961b45be26
Created October 23, 2014 17:11
Git clone all branches
#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
@jamesmehorter
jamesmehorter / gist:011cfeec683d42bf69ae
Created October 30, 2014 21:48
Import external url/image as WordPress attachment
<?php
// Import the YouTube video thumbnail as the post's featured image
// Only proceed if there is a youtube video thumbnail
/*
Example $youtube_video_data:
array(
'id' => 'gvk6TwmF0cw',
'title' => 'Tyler Posey talks to Variety about being honored at Variety Power of Youth',
'link' => 'http://www.youtube.com/watch?v=gvk6TwmF0cw',
'thumbnail' => 'http://i.ytimg.com/vi/gvk6TwmF0cw/hqdefault.jpg',
/* BEFORE */
.site-title {
background: url('images/logo.png') no-repeat;
height: 49px;
margin: 0;
padding: 0;
text-indent: -999em;
width: 268px;
}