This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery code to sort all definition lists on a page alphabetically, assuming terms and definitions alternate. Place in $(document).ready(function(){ }); | |
$("dl").each(function() { | |
$(this).children("dt").sort(function(a, b){ | |
return a.innerHTML.toUpperCase() > b.innerHTML.toUpperCase() ? 1 : -1; | |
}).each(function() { | |
var dd = $(this).next("dd"); | |
$(this).appendTo($(this).parent()); | |
dd.appendTo(dd.parent()); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------- | |
// Debugger that shows view port size. Helps when making responsive designs. | |
// ----------- | |
function showViewPortSize(display) { | |
if(display) { | |
var height = jQuery(window).height(); | |
var width = jQuery(window).width(); | |
jQuery('body').prepend('<div id="viewportsize" style="z-index:9999;position:fixed;top:40px;left:5px;color:#fff;background:#000;padding:10px">Height: '+height+'<br>Width: '+width+'</div>'); | |
jQuery(window).resize(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Need to include Modernizer (http://www.modernizr.com/) and jQuery (http://jquery.com/) | |
$(document).ready(function($){ | |
if (Modernizr.localstorage) { | |
$('#hide-button').click(function(e){ | |
localStorage.setItem('subscribed',true); | |
$('#sign-up-form,#hide-button').hide(); | |
$('#hide-button').hide(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Equal Heights Plugin | |
* Equalize the heights of all child elements to the tallest child | |
* | |
* @param object options | |
* - filter: An optional selector string to filter which children are considered. | |
* - not: An optional selector string to filter which children are NOT considered. | |
* - target: Additional selector of targets where height will be applied; these nodes | |
will not be used to calculate height, but will ONLY receive the calculated | |
height. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shadeColor($color, $percent) { | |
$num = base_convert(substr($color, 1), 16, 10); | |
$amt = round(2.55 * $percent); | |
$r = ($num >> 16) + $amt; | |
$b = ($num >> 8 & 0x00ff) + $amt; | |
$g = ($num & 0x0000ff) + $amt; | |
return '#'.substr(base_convert(0x1000000 + ($r<255?$r<1?0:$r:255)*0x10000 + ($b<255?$b<1?0:$b:255)*0x100 + ($g<255?$g<1?0:$g:255), 10, 16), 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_nav_menu( array( | |
'menu' => 'Menu Name', | |
'sub_menu' => true, | |
'direct_parent' => true | |
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_terms_chekboxes($taxonomies, $args) { | |
$terms = get_terms($taxonomies, $args); | |
foreach($terms as $term){ | |
$output .= '<label for="'.$term->slug.'"><input type="checkbox" id="'.$term->slug.'" name="'.$term->taxonomy.'" value="'.$term->slug.'"> '.$term->name.'</label>'; | |
} | |
return $output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) { | |
echo 'This is the last post'; | |
} ?> | |
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) { | |
echo 'This is the not the last post'; | |
} ?> |
OlderNewer