This is a collection of my most often used lines of code, as well as a few other examples I want to have ready at a moment's notice. These snippets focus on building HTML from scratch, linking in good web fonts, and setting up responsive styles for your pages.
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
RedirectMatch 301 /wp-json/.* http://domain.com |
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 | |
/****************************************************************************** | |
* Gallery Shortcode Re-format | |
******************************************************************************/ | |
add_filter( 'post_gallery', 'my_post_gallery', 10, 2 ); | |
function my_post_gallery( $output, $attr) { | |
global $post, $wp_locale; | |
static $instance = 0; | |
$instance++; |
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 | |
/** | |
* Custom Loop Add to Cart. | |
* | |
* Template with quantity and ajax. | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. | |
global $product; |
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
/*======================================* | |
*====== Default CSS | Author: KL ======* | |
*======================================*/ | |
*, | |
*:before, | |
*:after { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
text-rendering: optimizeLegibility; |
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
/* | |
# 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. |
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
/*************************************************************************/ | |
/* 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"; |
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 | |
// 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(); | |
} |
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 | |
/** | |
* 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'); |
A Pen by Kael Steinert on CodePen.
NewerOlder