Skip to content

Instantly share code, notes, and snippets.

@digiltd
digiltd / google-maps-no-scroll.js
Last active September 11, 2015 23:20
google-maps no-scroll
if ($("#contact").length) {
function initialize() {
var myLatLong = new google.maps.LatLng(40.7526, -73.9797);
var mapOptions = {center: myLatLong,scrollwheel: false,zoom: 13};
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({position: myLatLong,map: map,title: "123 Broadway"});
}
google.maps.event.addDomListener(window, 'load', initialize);
}
add_action( 'wp_enqueue_scripts', 'conditional_load_enqueue' );
function conditional_load_enqueue() {
if ( is_singular(array('foo', 'bar', 'baz' )) ) {
wp_enqueue_script('flickity', get_template_directory_uri() . '/bower_components/flickity/dist/flickity.pkgd.min.js', array('jquery'), '0.3.1', true);
}
@digiltd
digiltd / gist:139971544fdc208f84ba
Last active September 11, 2015 23:24
mixin for responsive ratio image background
/* Calculate fluid ratio based on two dimensions (width/height) */
@mixin fluid-ratio($large-size, $small-size) {
$width-large: nth($large-size, 1);
$width-small: nth($small-size, 1);
$height-large: nth($large-size, 2);
$height-small: nth($small-size, 2);
$slope: ($height-large - $height-small) / ($width-large - $width-small);
$height: $height-small - $width-small * $slope;
padding-top: $slope * 100%;
@JimiWikman
JimiWikman / Open Graph for WooCommerce
Created July 27, 2014 02:37
Open Graph for WooCommerce
<?php if ( is_home() ) { // If on the homepage ?>
<!--/ Open Graph for Homepage /-->
<meta property="og:title" content="<?php echo get_bloginfo(strip_tags('name')) ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo home_url() ?>" />
<meta property="og:description" content="<?php echo get_bloginfo (strip_tags('description')) ?>" />
<meta property="og:site_name" content="<?php echo get_bloginfo(strip_tags('name')) ?>" />
<meta property="og:image" content="http://unglove.me/path-to-thumbnail-image.jpg" />
<?php } ?>
<?php if ( is_woocommerce() ) { // If on a woocommerce page ?>
/*
Cross-browser (including IE8-10)
Más info: http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
*/
.absolute-center {
/* height: must be declared */
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->