Skip to content

Instantly share code, notes, and snippets.

View JacobLett's full-sized avatar
🤠
hello!

Jacob Lett JacobLett

🤠
hello!
View GitHub Profile
@JacobLett
JacobLett / gist:79ae2cf80ccf5ea08cee
Created August 20, 2015 18:57
yoast breadcrumbs - css
/* yoast breadcrumbs */
#breadcrumbs {font-size: 75%; color: #8e908f;margin:1em 0 2em 0;}
#breadcrumbs a {display: inline; border: none; padding: 0; text-transform: none;}
@JacobLett
JacobLett / gist:e7be42be4013bd0bed79
Created August 20, 2015 18:58
Yoast Breadcrumbs HTML - Add to template file
<!-- BEFORE -->
<?php if ( function_exists( 'yoast_breadcrumb' ) ) { yoast_breadcrumb(); } ?>
<!-- AFTER -->
<div id="breadcrumbs"><?php if ( function_exists( 'yoast_breadcrumb' ) ) { yoast_breadcrumb(); } ?></div>
@JacobLett
JacobLett / minified
Last active June 27, 2018 19:58
CSS reset - default values
.reset-this {
animation : none;
animation-delay : 0;
animation-direction : normal;
animation-duration : 0;
animation-fill-mode : none;
animation-iteration-count : 1;
animation-name : none;
animation-play-state : running;
animation-timing-function : ease;
@JacobLett
JacobLett / gist:99644f62804dfcb54a15
Last active May 27, 2019 12:12
Google Analytics Event Tracking - jQuery
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
// Tracks btn clicks - link needs title tag and class="btn" to work
$('.btn').click(function(){
_gaq.push(['_trackEvent', 'btn clicks', 'Click', $(this).attr('title')]);
});
// Tracks PDF downloads - link needs title tag and class="pdf" to work
@JacobLett
JacobLett / utility.css
Created September 9, 2015 17:41
Utility CSS classes - grids, floats, clears, image replacement
/* --------------------------
Utility classes
-------------------------- */
.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;}
.flush-c {text-align:center;}
.flush-l {text-align:left;}
.flush-r {text-align:right;}
.inlineList li {display:inline;list-style-type:none;}
@JacobLett
JacobLett / gist:aef48170089c59718a83
Created September 18, 2015 19:09
rock solid jquery tabs - hash active tab
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>jQuery Tabs Demo</title>
<style>
* {padding:0; margin:0;}
html {
@JacobLett
JacobLett / gist:e80801c40c4b1aea154d
Created September 21, 2015 14:45
enque scripts and styles wordpress
function richwp_scripts_styles() {
wp_enqueue_style( 'richwp-style', get_stylesheet_uri(), '', '1.0', false );
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/js/modernizr-2.6.1.min.js', '', '1.0', false);
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'plugins', get_template_directory_uri() . '/js/plugins.js', array('jquery'), '1.0', true);
}
add_action( 'wp_enqueue_scripts', 'richwp_scripts_styles' );
@JacobLett
JacobLett / gist:7189da2e11fd3f4f6938
Created September 22, 2015 12:49
Get url parameter jquery
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
@JacobLett
JacobLett / gist:2a06a58d98b302472398
Created September 22, 2015 13:03
find and replace string jquery
$('#ValidationSummary p').text(function (i, old) {
return old
.replace('your title', 'a title')
.replace('first name', 'christian name')
.replace('your surname', 'your last name');
});
@JacobLett
JacobLett / gist:e2889aea6a2de653b822
Created September 24, 2015 18:10
Check to see if all child elements are display none - if so hide the parent container jQuery
// Checks to see if the competitions box is empty
if ( jQuery("#sidebar #primary .textwidget a").css("display") == "none" ) {
jQuery('#sidebar #primary').remove();
}