Skip to content

Instantly share code, notes, and snippets.

@avantegarde
avantegarde / auto-space.js
Last active February 24, 2016 18:45
Auto adjust the padding at the top of the site to match the header height for fixed header bars. Also set a min-height for the main content area so the footer gets pushed to the bottom of the browser window if page is shorter.
/*************************************************************************/
/* Auto-Sizing header, footer, hero caption text
/*************************************************************************/
// Page top padding based on height of the header
function autoHeaderHeight() {
var header = document.getElementsByClassName("navbar-fixed-top")[0];
var pageBody = document.getElementsByClassName("content-area")[0];
if (header && pageBody){
var headerHeight = header.clientHeight;
pageBody.style.paddingTop = headerHeight + "px";
@avantegarde
avantegarde / match-height.js
Created February 24, 2016 18:41 — forked from tomhodgins/match-height.js
Match Height is a jQuery-free pure JavaScript plugin that will measure the height of a group of elements and assign each of them the highest value.
/*
# The Mad CSScientist's Matching Height Plugin
written by Tommy Hodgins: http://codepen.io/tomhodgins/pen/pjmKNj
## Usage
This plugin will measure the height of a group of elements and assign each of them the highest value.
To group elements together, assign each element a `data-col` attribute with the same value. This way, the plugin can calculate the heights of different groups of elements on the same page.
@avantegarde
avantegarde / kl-default.css
Last active March 24, 2016 14:12
A good starting point for your CSS
/*======================================*
*====== Default CSS | Author: KL ======*
*======================================*/
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-rendering: optimizeLegibility;
@avantegarde
avantegarde / add-to-cart.php
Created March 25, 2016 18:42 — forked from claudiosanches/add-to-cart.php
WooCommerce - Template add-to-cart.php with quantity and Ajax!
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@avantegarde
avantegarde / redirect-wp-rest-api-urls.txt
Created November 29, 2017 20:39
This 1 line needs to be placed in your .htaccess file in the root folder where your wordpress is installed.
RedirectMatch 301 /wp-json/.* http://domain.com