Skip to content

Instantly share code, notes, and snippets.

@awakekat
awakekat / Google WP Enqueue
Created February 23, 2015 03:50
Enqueue Google Fonts into Child Theme
add_action('wp_print_styles', 'load_fonts');
function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Rock+Salt|Neucha');
wp_enqueue_style( 'googleFonts');
}
//* Change the "http://" address from the use code from the google font you want
@awakekat
awakekat / clearfix
Created February 27, 2015 05:18
Clearfix - add class to parent element
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
@awakekat
awakekat / grid-with-sass
Created March 2, 2015 14:41
Grid with Sass
// Set the variables
$width: 1140px;
$columns: 12;
$gutter: 24px;
// Create the row
.row {
width: 100%;
max-width: $width;
box-sizing: border-box;
@awakekat
awakekat / wp-admin
Last active July 19, 2017 14:47
Custom wp-admin tweaks
/*
* Custom Tweaks
*/
define('WP_HOME', 'http://sitename.com'); // Lock settings of URL in Admin
define('AUTSAVE_INTERVAL', 120); // in seconds
define('WP_POST_REVISIONS', 4); // Max # of post revision history
define('EMPTY_TRASH_DAYS', 3); // # of days
define('DISALLOW_FILE_EDIT', true); // Lock out CSS in Admin
@awakekat
awakekat / specialdatephp.txt
Last active November 25, 2015 17:25
Show text on Special Date
<?php
if ((date('m') == 4) && (date('d') == 9)) { ?>
<p>Today is <a href="http://naked.dustindiaz.com/">CSS Naked Day</a>!</p>
<?php } ?>
@awakekat
awakekat / csscomb.txt
Created November 28, 2015 00:57
CSSComb config
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": false,
"leading-zero": false,
"quotes": "double",
@awakekat
awakekat / mobile-mixin.txt
Created December 4, 2015 04:10
sass mobile first
@mixin size($break) {
@if $break == small {
@media (min-width: 580px) { @content; }
}
@else if $break == medium {
@media (min-width: 1080px) { @content; }
}
@else if $break == large {
@media (min-width: 1280px) { @content; }
}
@awakekat
awakekat / trunucation.txt
Created January 18, 2016 02:27
php truncation
<?php
$text = types_render_field("about-text", array("output"=>"raw"));
function truncate($text, $chars = 300) {
$text = $text." ";
$text = substr($text,0,$chars);
$text = substr($text,0,strrpos($text,' '));
$text = $text."...";
return $text;
}
$test = truncate($text);
// Creates Login Shortcode
// Shortcode Usage: [loginform redirect="http://my-redirect-url.com"]
function pippin_login_form_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'redirect' => ''
), $atts ) );
if (!is_user_logged_in()) {