Skip to content

Instantly share code, notes, and snippets.

View anneallen's full-sized avatar

Anne Allen anneallen

View GitHub Profile
@anneallen
anneallen / Modernizer
Last active December 27, 2015 14:29
Add Modernizer to html class
//Add Modernizer
function eva_modernizer_doctype() {
?>
<!DOCTYPE html>
<html class="no-js" <?php language_attributes( 'html' ); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php
}
@anneallen
anneallen / gist:7341433
Created November 6, 2013 18:23
Add ie selector to html tag
function eva_IE_doctype() {
?>
<!DOCTYPE html>
<!--[if IEMobile 7 ]> <html dir="ltr" lang="en-US"class="no-js iem7"> <![endif]-->
<!--[if lt IE 7 ]> <html dir="ltr" lang="en-US" class="no-js ie6 oldie"> <![endif]-->
<!--[if IE 7 ]> <html dir="ltr" lang="en-US" class="no-js ie7 oldie"> <![endif]-->
<!--[if IE 8 ]> <html dir="ltr" lang="en-US" class="no-js ie8 oldie"> <![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html <?php language_attributes( 'html' ); ?>><!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
@anneallen
anneallen / gist:7420354
Created November 11, 2013 21:08
Add Placeholder text to wordpress login forms
// JavaScript Document
jQuery(function ($) {
/* You can safely use $ in this code block to reference jQuery */
$(document).ready(function(){
$('form').find('input[name="log"]').each(function(ev)
{
if(!$(this).val()) {
@anneallen
anneallen / gist:9605275
Created March 17, 2014 18:25
Social share buttons for genesis
add_action( 'genesis_entry_content', 'child_share_buttons',6);
function child_share_buttons (){
$return_string .='<ul class="share_buttons">';
$return_string .= '<li>
<a href="https://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a> </li>
<li class="fb">
<div class="fb-share-button" data-href="http://developers.facebook.com/docs/plugins/" data-type="button"></div>
</li>
// ADDING CUSTOM POST TYPE - business card
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// Pledge Items
array('the_type' => 'bcard',
'single' => 'Business Card',
@anneallen
anneallen / gist:10340261
Last active August 29, 2015 13:58
Remove Genesis Post meta and Post info for all but standard posts
//Remove post-info and post meta for all but post
remove_action('genesis_entry_header', 'genesis_post_info',12);
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
add_action('genesis_entry_header', 'child_post_info',12);
function child_post_info(){
if (is_singular( 'post' ))
genesis_post_info();
}
//Clicky Boxes
/**
*This creates a widget area for text, and the whole box is clickable
*
*/
/** Register Widget **/
function lob_boxes_load_widgets() {
register_widget( 'Lob_Boxes_Widget' );
/**
*This creates a box for optin, with separate text and form
*/
/** Register Opt in Widget **/
function lob_signup_box_load_widgets() {
register_widget( 'lob_signup_box_Widget' );
}
add_action( 'widgets_init', 'lob_signup_box_load_widgets' );
@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 )
@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 =