Skip to content

Instantly share code, notes, and snippets.

Scott Lyttle scottlyttle

Block or report user

Report or block scottlyttle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3549bdc46af12932744cc446190341e4
/**
* Vertical rhythm by Syncope
* http://nowodzinski.pl/syncope
*/
html, body {
font: 16px/1.7 'Helvetica';
}
$v-rhythm-levels: (
View old-underscores-header-markup.php
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', '_s' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', '_s' ); ?>"><?php _e( 'Skip to content', '_s' ); ?></a></div>
View old-underscores-header-markup.php
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', '_s' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', '_s' ); ?>"><?php _e( 'Skip to content', '_s' ); ?></a></div>
@scottlyttle
scottlyttle / functions.php
Last active Dec 20, 2015
Deregister scripts and styles on pages they're not needed (WordPress)
View functions.php
add_action( 'wp_enqueue_scripts', 'deregister_cf7_javascript', 15 );
function deregister_cf7_javascript() {
if ( !is_page(15) ) {
wp_deregister_script( 'contact-form-7' );
}
}
add_action( 'wp_enqueue_styles', 'deregister_cf7_styles', 15 );
function deregister_cf7_styles() {
if ( !is_page(15) ) {
wp_deregister_style( 'contact-form-7' );
@scottlyttle
scottlyttle / .htaccess
Created Jul 23, 2013
Add SVG support for media template hosted sites
View .htaccess
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
View frontendDevlopmentBookmarks.md
View twitter.js
/*********************************************************************
* #### Twitter Post Fetcher v7.0 ####
* Coded by Jason Mayes 2013. A present to all the developers out there.
* www.jasonmayes.com
* Please keep this disclaimer with my code if you use it. Thanks. :-)
* Got feedback or questions, ask here:
* http://www.jasonmayes.com/projects/twitterApi/
* Updates will be posted to this site.
*********************************************************************/
var twitterFetcher=function(){function t(d){return d.replace(/<b[^>]*>(.*?)<\/b>/gi,function(c,d){return d}).replace(/class=".*?"|data-query-source=".*?"|dir=".*?"|rel=".*?"/gi,"")}function m(d,c){for(var f=[],e=RegExp("(^| )"+c+"( |$)"),g=d.getElementsByTagName("*"),b=0,a=g.length;b<a;b++)e.test(g[b].className)&&f.push(g[b]);return f}var u="",j=20,n=!0,h=[],p=!1,k=!0,l=!0,q=null,r=!0;return{fetch:function(d,c,f,e,g,b,a){void 0===f&&(f=20);void 0===e&&(n=!0);void 0===g&&(g=!0);void 0===b&&(b=!0);
View gravity_forms_australian_formatted_address.php
function g8_aus_address( $address_types, $form_id ){
$address_types["australia"] = array(
"label" => "Australian",
"country" => "Australia",
"zip_label" => "Postcode",
"state_label" => "State",
"states" => array(
"NT" => "NT",
"ACT" => "ACT",
"NSW" => "NSW",
@scottlyttle
scottlyttle / functions.php
Created May 17, 2013
Wrap WordPress inserted images in <figure> and <figcaption> elements
View functions.php
function html5_insert_image($html, $id, $caption, $title, $align, $url) {
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
if ($caption) {
$html5 .= "<figcaption>$caption</figcaption>";
}
$html5 .= "</figure>";
return $html5;
}
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );
@scottlyttle
scottlyttle / next-prev-overide.js
Last active Dec 14, 2015
jQuery snippet to output a span in place of a next or previous link in WordPress (as one is not output when there is no next previous page).
View next-prev-overide.js
// store the links parent selectors as variables
var $next = $(".next");
var $prev = $(".prev");
// if the prev posts link doesn't exist but the next link does
if ($prev.children().length == 0 && $next.children().length > 0) {
// add a span with prev
$prev.append('<span class="disabled">Prev</span>');
// if the next posts link doesn't exist but the prev one does
} else if ($next.children().length == 0 && $prev.children().length > 0) {
// add a span with next
You can’t perform that action at this time.