This file contains hidden or 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
var geojson = {}; | |
geojson['type'] = 'FeatureCollection'; | |
geojson['features'] = []; | |
for (var k in data) { | |
var newFeature = { | |
"type": "Feature", | |
"geometry": { | |
"type": "Point", | |
"coordinates": [parseFloat(data[k].lng), parseFloat(data[k].lon)] |
This file contains hidden or 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
$(document).ready(function($){ | |
$('#open').click(function(){ | |
$('#element').toggle(300).addClass('active'); | |
}); | |
$('#close').click(function(){ | |
if($('#element').hasClass('active')) { | |
$('#element').toggle(300).removeClass('active'); | |
} | |
}); | |
}); |
This file contains hidden or 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
var height = $('header').height(); // element to offset scroll with (i.e. your navbar if it is fixed) | |
$('a[href*=#]').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') | |
&& location.hostname == this.hostname) { | |
var $target = $(this.hash); | |
$target = $target.length && $target | |
|| $('[name=' + this.hash.slice(1) +']'); | |
if ($target.length) { | |
var targetOffset = ($target.offset().top)-height; //offset from top based on element - this isn't required | |
$('html,body') |
This file contains hidden or 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
$.ajax({ | |
type: "GET", | |
dataType: "jsonp", | |
contentType: "application/json", | |
url: 'http://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=131+Riverlawn+Ave%2C+Watertown%2C+53094&benchmark=9&format=jsonp', | |
success: function(data) { | |
console.log(data) | |
}, | |
error: function(xhr, ajaxOptions, thrownError) { | |
console.log(xhr.status, thrownError); |
This file contains hidden or 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 | |
// using a specified custom taxonomy slug | |
// find all taxonomy terms (categories) and | |
// the associated posts | |
$tax = 'TAXONOMY-SLUG'; | |
echo '<ul>'; | |
$terms = get_terms($tax); | |
foreach($terms as $term) { | |
echo '<li>'.$term->name; |
This file contains hidden or 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 // get youtube ID function | |
function get_youtube_id($url) { | |
$query_string = array(); | |
parse_str(parse_url($url, PHP_URL_QUERY), $query_string); | |
$id = $query_string["v"]; | |
return $id; | |
} |
This file contains hidden or 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
#parallax-wrap { | |
height: 400px; /* anything you want/need */ | |
width: 100%; | |
position: relative; | |
display: block; | |
} | |
.parallax { | |
position:absolute; | |
width:100%; | |
height:100%; |
This file contains hidden or 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 addCommas(n) { | |
var str = n.toString(), | |
len = str.length, | |
num = str.slice(0, len%3); | |
for(i=0;i<Math.floor(len/3);i++) { | |
num = num + ',' + str.substr(len%3+(3*i), 3); | |
} | |
if(num.slice(0,1)===',') { |
This file contains hidden or 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(document).ready(function($) { | |
$('.post').on('click', function(){ | |
getPostInfo($(this).attr('data-postid')); | |
}); | |
}); | |
function getPostInfo(id) { | |
jQuery.ajax({ | |
url: ajaxurl, | |
dataType: 'json', |