Skip to content

Instantly share code, notes, and snippets.

View leoken's full-sized avatar

Erik James Albaugh leoken

  • Maintain Web
  • Long Beach, CA
  • X @leoken
View GitHub Profile
.video { position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; }
.video img { position: absolute; display: block; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; cursor: pointer; }
.video:after { content: ""; position: absolute; display: block;
background: url(play-button.png) no-repeat 0 0;
top: 45%; left: 45%; width: 46px; height: 36px; z-index: 30; cursor: pointer; }
.video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* image poster clicked, player class added using js */
.video.player img { display: none; }
.video.player:after { display: none; }
@leoken
leoken / .gitignore
Created November 11, 2013 10:31 — forked from redoPop/.gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
<?php
/*
GeoRSS formatted output for Google Maps
Authors: Alastair Mucklow, Chris Toppon
*/
//header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
//$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'" standalone="yes"?'.'>'; ?>
<?php
/**
* Hook in on activation
*/
global $pagenow;
if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) add_action( 'init', 'yourtheme_woocommerce_image_dimensions', 1 );
/**
* Define image sizes
*/
import requests
import json
username = 'my-user'
apikey = 'my-api-key'
url = 'https://test.my-marconi-server.com:443'
class Queue_Connection(object):
def __init__(self, username, apikey):
@leoken
leoken / top_level_parent_class.php
Created April 4, 2013 10:03
adds a class to the top level parent of a page or post
<?php
function top_level_parent_class($classes) {
global $post;
if (is_page() && !$post->post_parent && !is_front_page()) {
$classes[] = 'page-top-parent';
}
return $classes;
}
add_filter('body_class', 'top_level_parent_class');
<?php
/**
* Display a thumbnail from YouTube based off the embed code saved in the
* video post format metabox used by the CF Post Formats plugin
*
* @link https://github.com/crowdfavorite/wp-post-formats
* @link http://stackoverflow.com/a/6382259
*/
global $post;
@leoken
leoken / get-grandparent__grandparent_body_class.php
Created April 4, 2013 09:50
Adds a Grand Parent class to the body
<?php
function get_grandparent($page_id) {
$current_page = get_page($page_id);
if ($current_page->post_parent > 0) {
$parent_page = get_page($current_page->post_parent);
if ($parent_page->post_parent > 0) {
return $parent_page->post_parent;
} else {
return false;
<?php
/**
* Add 'class="span4"' to all widgets in the Content Bottom sidebar
*/
function bb_content_bottom_widget_class($params) {
if ($params[0]['id'] == 'roots-content-bottom') {
$class = 'class="span4 ';
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);
}