Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / pantheon-redirect-all.php
Last active February 23, 2016 20:41
Redirect and match ALL urls to new domain
<?php
// Redirect ALL urls to another domain
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) &&
($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') &&
(php_sapi_name() != "cli")) {
$newurl = 'http://www.jfrohrbaugh.com/'. $_SERVER['REQUEST_URI'];
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");
exit();
}
<?php
/**
* For developers: WordPress debugging mode.
*
* If the default WP_DEBUG function is set to false and
* there are still warnings or errors showing up, try
* using the following instead
*/
ini_set('log_errors','On');
ini_set('display_errors','Off');
@avantegarde
avantegarde / snippets.md
Created November 19, 2015 00:58 — forked from tomhodgins/snippets.md
Snippets.md is my most often used HTML, CSS and JavaScript snippets for front-end web development
@avantegarde
avantegarde / Fancy Line Box with content area.markdown
Created October 21, 2015 19:09
Fancy Line Box with content area