Skip to content

Instantly share code, notes, and snippets.

View ajskelton's full-sized avatar

Anthony ajskelton

View GitHub Profile
@ajskelton
ajskelton / Contact-Form-7 only on pages with form
Created March 23, 2014 12:08
Contact Form 7 - Removes the loading of CF7 files on every page, and only on the "Contact" page.
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
if ( !is_page('Contact') ) {
wp_deregister_script( 'contact-form-7' );
}
}
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
if ( !is_page('Contact') ) {
wp_deregister_style( 'contact-form-7' );
@ajskelton
ajskelton / SassMeister-input-HTML.html
Created June 16, 2014 14:28
Generated by SassMeister.com.
<div class="container">
<header></header>
<section id="hero"></section>
<h2>photography &amp; design</h2>
<section id="services">
<ul>
<li><h3>portraits</h3></li>
<li><h3>events</h3></li>
<li><h3>maternity</h3></li>
<li><h3>promotional</h3></li>
@ajskelton
ajskelton / Mediawiki #Ask Asset_Tags
Created December 21, 2013 20:49
A semantic mediawiki ask codeblock for all data sorted by asset tag
{{#ask: [[Category:Asset_Tags]]
| ?Manufacturer
| ?Device_Name
| ?Serial_Number
| ?Model_Number
| ?Location
| format=broadtable
| limit=500
}}
@ajskelton
ajskelton / getRGB(hex)
Last active December 31, 2016 14:42
A function that takes a HEX code and returns the rgb value.
function getRGB(hex) {
if(hex[0] === '#') {
hex = hex.substring(1,7);
}
var r = parseInt(hex.substring(0,2),16);
var g = parseInt(hex.substring(2,4),16);
var b = parseInt(hex.substring(4,6),16);
return 'rgb(' + r + ', ' + g + ', ' + b + ')';
@ajskelton
ajskelton / _footer-widgets.scss
Created February 11, 2017 13:40
Genesis Footer Widget Widths based on number of Footer Widgets - by Dave Browne
@ajskelton
ajskelton / removeHash
Created June 26, 2017 16:34
Remove the hash from a url and keep the browser in the same scroll position
function removeHash () {
var scrollV, scrollH, loc = window.location;
if ("pushState" in history)
history.pushState("", document.title, loc.pathname + loc.search);
else {
// Prevent scrolling by storing the page's current scroll offset
scrollV = document.body.scrollTop;
scrollH = document.body.scrollLeft;
loc.hash = "";
$regex = "/([0-9]{1,2}:[0-9]{2}:[0-9]{2})\s(AM|PM|XM)\s{0,1}\*{3}\s{0,3}\ *{1,2}LOCAL.*?([0-9]{1,2}:[0-9]{2})/";
@ajskelton
ajskelton / custom-post-type-labels.php
Created February 17, 2017 01:23
WordPress Custom Post Type Labels
/**
* Get the post type labels configuration
*
* @param string $post_type
* @param string $singular_label
* @param string $plural_label
*
* @return array
*/
function get_TODO_post_type_labels_config( $post_type, $singular_label, $plural_label ) {
body {
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif;
}
@ajskelton
ajskelton / WordPress Speed Boosts
Last active November 21, 2018 19:23
Code snippits to speed up WordPress site
// Limit post revisions to 3
define( 'WP_POST_REVISIONS', 3 );
// Empty trash every 7 days instead of the default 30
define('EMPTY_TRASH_DAYS', 7);