Skip to content

Instantly share code, notes, and snippets.

View anneallen's full-sized avatar

Anne Allen anneallen

View GitHub Profile
@anneallen
anneallen / Open Graph HTML and header tags
Last active September 1, 2016 23:26
Add Open Graph HTML and header tags to Genesis Theme
/**Adding the Open Graph in the Language Attributes*/
add_filter('language_attributes', 'child_add_opengraph_doctype');
function child_add_opengraph_doctype( $output ) {
return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
}
/** Add Open Graph meta tag to head*/
@anneallen
anneallen / gist:5958572
Created July 9, 2013 15:59
Avoid iPhone Text Resizing
body {
‑webkit‑text‑size‑adjust: 100%
}
@anneallen
anneallen / gist:5963584
Created July 10, 2013 04:58
Add shortcodes to widgets
/**Add shortcodes to widgets*/
add_filter('widget_text', 'do_shortcode');
@anneallen
anneallen / gist:5996453
Created July 14, 2013 22:56
Add Images to Taxonomies
/******Step 1, Add to Functions.php **************
**************************************************/
add_action( 'admin_init', 'custom_add_taxonomy_archive_options' );
/**
* Loop through the custom taxonomies and add the archive options to each
* custom taxonomy edit screen.
*
* @category Genesis
* @package Admin
@anneallen
anneallen / gist:6047160
Created July 21, 2013 01:50
Add print functionality
<div class="printer" title="">
<script language="JavaScript">
if (window.print) {
document.write('<form> ' + '<input type=button name=print value="" ' + 'onClick="javascript:window.print()"></form>');
}
</script>
</div>
@anneallen
anneallen / gist:6066302
Created July 23, 2013 21:24
Add Viewport Meta tag for non-responsive design
/** Add Viewport meta tag for mobile browsers */
add_action( 'genesis_meta', 'add_viewport_meta_tag' );
function add_viewport_meta_tag() {
echo '<meta name="viewport" content="width=1480">';
}
@anneallen
anneallen / gist:6703795
Created September 25, 2013 18:22
/** Conditional html element classes for Genesis HTML 5 as per Paul Irish method
/** Conditional html element classes for HTML 5 */
remove_action( 'genesis_doctype', 'genesis_do_doctype' );
add_action( 'genesis_doctype', 'child_do_doctype' );
function child_do_doctype() {
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" <?php language_attributes( 'html' ); ?>> <![endif]-->
@anneallen
anneallen / gist:6828937
Created October 4, 2013 16:44
Remove the [...] from excerpt
function new_excerpt_more( $more ) {
return '[...]';
}
add_filter('excerpt_more', 'new_excerpt_more');
@anneallen
anneallen / gist:6856834
Created October 6, 2013 17:35
Mobile redirect - just discovered it as a built in Wordpress function
if ( wp_is_mobile() ) {
wp_redirect( 'http://example.com/m/' );
exit;
}
@anneallen
anneallen / gist:6966997
Created October 13, 2013 20:20
Allow line breaks and spans in widget title
/**Allow line breaks and spans in widget title*/
add_filter('widget_title','my_widget_title',10,3);
function my_widget_title($title)
{
$title = str_replace("[br]", "<br/>", $title);
$title = str_replace("[sp]", "<span>", $title);
$title = str_replace("[/sp]", "</span>", $title);
return $title;
}