Skip to content

Instantly share code, notes, and snippets.

View anneallen's full-sized avatar

Anne Allen anneallen

View GitHub Profile
@anneallen
anneallen / Rotate Videos
Created January 2, 2015 19:05
Rotate Video 90 degrees using Handbrake
//This is a handy trick to rotate videos filmed in the wrong orientation (big problem with smartphones)
//Use Handbrake Version (0.99 or higher)
, --rotate=4
on the Extra Options under Video tab
@anneallen
anneallen / gist:a9672ad86f7984c5549c
Created December 15, 2014 19:16
Fix Lightbox showing behind Youtube iframe
//Add ?wmode=transparent&rel=0 to the youtube embed src
//Before
/*
<iframe width="560" height="315" src="//www.youtube.com/embed/Grgztdps2Rc" frameborder="0" allowfullscreen></iframe>
*/
//After - and it works
<iframe width="560" height="315" src="//www.youtube.com/embed/Grgztdps2Rc?wmode=transparent&rel=0" frameborder="0" allowfullscreen></iframe>
@anneallen
anneallen / gist:d2a831f07b7ba98bd211
Created December 5, 2014 06:15
Tiger Stripe to WP_query
$recent = new WP_Query(array(
'post_type'=> array( 'testimonial'),
'orderby' => 'date',
'order'=> 'DESC',
'posts_per_page'=> -1,
'homeselect'=>$taxon
));
@anneallen
anneallen / titletag_amend
Created June 18, 2014 18:42
Remove Yoast Wordpress SEO Title tag filter (genesis framework)
//Change Title tag from yoast
global $wpseo_front;
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
//Add Custom title tag
add_filter( 'wp_title', 'child_loops_title', 10, 3 );
function child_loops_title( $title, $sep, $seplocation ) {
$test = ucfirst((get_query_var('state')));
$brand_aa = ucfirst((get_query_var('brands')));
$sep = genesis_get_seo_option( 'doctitle_sep' ) ? genesis_get_seo_option( 'doctitle_sep' ) : '–';
@anneallen
anneallen / jquery Bumper
Created June 11, 2014 19:05
Jquery bumper snippet
//Snippet for make bumper screenheight -200px
jQuery(function ($) {
$('.bumper') .css({'height': ($(window).height()-200)+'px'});
$(window).resize(function(){
$('.bumper') .css({'height': (($(window).height()-200))+'px'});
});
/* You can safely use $ in this code block to reference jQuery */
});
@anneallen
anneallen / jquery-width-height
Created June 11, 2014 19:04
Jquery for screen width and height
jQuery(function ($) {
$(document).ready(function(e) {
showViewportSize();
});
$(window).resize(function(e) {
var windowsize = $(window).height();
$(".home-bottom").toggleClass("tiny",(windowsize < 780));
@anneallen
anneallen / gist:dd47356e78ffadfbc785
Last active September 11, 2015 01:26
Replace Genesis Page tite with Fancy wordy title
//* Remove page title for a specific page (requires HTML5 theme support)
//* This requires a custom metabox '_lob_fancy_title' to be added to the page template
/**
* Create Metaboxes For Page Fancy Title
*/
function lob_fancytitle_create_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
@anneallen
anneallen / gist:ddd383b1bba13d0348af
Created May 13, 2014 21:16
Google maps API v3 Directions using data from cmb_field_map_master
//Using safe jquery for Wordpress
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var myLatlng = new google.maps.LatLng(jQuery( '#stores li' ).data( 'latitude' ), jQuery( '#stores li' ).data( 'longitude' ));
@anneallen
anneallen / gist:ef54c3b34bb5c6bee7b2
Created May 11, 2014 20:21
Add a read more toggle
function toggle_shorten_string($string, $wordsreturned)
/* Returns the first $wordsreturned out of $string. If string
contains more words than $wordsreturned, the entire string
is returned.*/
{
$retval = $string; // Just in case of a problem
$array = explode(".", $string);
/* Already short enough, return the whole thing*/
$c = count($array);
$strlength =
@anneallen
anneallen / gist:3a60a953ecccd561e0af
Last active August 29, 2015 14:01
Add Zebra stripping class to every 2nd post
//*Add "even" class to every 2nd post/CBT
function aa_archive_post_class( $classes ) {
// Don't run on single posts or pages
if( is_singular() )
return $classes;
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 )