Skip to content

Instantly share code, notes, and snippets.

@angeliquejw
angeliquejw / _font-face.scss
Last active December 18, 2015 04:59
font-face mixin
@mixin font-face($font-family, $url, $weight: normal, $style: normal, $svgadd: "Regular") {
@font-face {
font-family: $font-family;
src: url($url + ".eot");
src: url($url + ".eot?#iefix") format("embedded-opentype"),
url($url + ".woff") format("woff"),
url($url + ".ttf") format("truetype"),
url($url + ".svg#" + $font-family + $svgadd) format("svg");
font-weight: $weight;
font-style: $style;
@angeliquejw
angeliquejw / _reset.scss
Last active December 18, 2015 04:59
Based on the reset included with Elliot Jay Stocks Starkers theme, in turn adapted from Normalize, HTML5 Boilerplate and HTML5 Doctor Reset.
/**
* Adapted from:
* Normalize.css by Nicolas Gallagher and Jonathan Neal:https://github.com/necolas/normalize.css/
* HTML5 boilerplate:http://html5boilerplate.com/
* HTML5 Doctor Reset by Eric Meyer and Richard Clark:html5doctor.com/html-5-reset-stylesheet/
* Modified by Elliot Jay Stocks
*/
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video {
background:transparent;
@angeliquejw
angeliquejw / Background color from array
Last active December 18, 2015 04:59
Random background color from specified color array, plus ability to coordinate site elements to match. Based on code from the following: http://www.thecodepress.info/2013/05/change-background-color-on-every.html#.UbHqwpwYh3B http://lab.clearpixel.com.au/2008/06/darken-or-lighten-colours-dynamically-using-php/
<?php
$colors = Array("#028cd5", "#b6cd3f", "#fa6128", "#fdb93c", "#ab4785");
$color_change = "";
$change = rand(1, 5);
switch($change){
case 1: $color_change = $colors[0];
break;
case 2: $color_change = $colors[1];
break;
case 3: $color_change = $colors[2];
@angeliquejw
angeliquejw / _palette.scss
Last active December 18, 2015 05:09
SCSS tinted palette generator and viewer (Initial color palette by chuvisco via ColourLovers: http://clrlv.rs/13qfvTf)
//Mixins //
@mixin palette-theme($color) {
.main { background-color:$color; }
.light { background-color:lighten($color,3%); }
.lighter { background-color:lighten($color,5%); }
.lightest { background-color:lighten($color,10%); }
.dark { background-color:darken($color,3%); }
.darker { background-color:darken($color,5%); }
.darkest { background-color:darken($color,10%); } }
@angeliquejw
angeliquejw / countries.txt
Last active December 19, 2015 07:39
shortcode list of countries & states for Contact Form 7
[select your-country include_blank "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua and Barbuda" "Argentina" "Armenia" "Arctic Ocean" "Aruba" "Ashmore and Cartier Islands" "Atlantic Ocean" "Australia" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Baker Island" "Bangladesh" "Barbados" "Bassas da India" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia and Herzegovina" "Botswana" "Bouvet Island" "Brazil" "British Virgin Islands" "Brunei" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Canada" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Clipperton Island" "Cocos Islands" "Colombia" "Comoros" "Cook Islands" "Coral Sea Islands" "Costa Rica" "Cote d'Ivoire" "Croatia" "Cuba" "Cyprus" "Czech Republic" "Denmark" "Democratic Republic of the Congo" "Djibouti" "Dominica" "Dominican Republic" "East Timor" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethi
@angeliquejw
angeliquejw / httpd-vhosts
Created July 24, 2013 15:00
1. Create new directory and index.html 2. Update windows host file @ C:\windows\system32\drivers\etc\hosts (127.0.0.1 MySite.Dev) 3. Update httpd-vhosts file (see below) 4. Copy WordPress files to directory from step 1 5. Go to phpmyadmin, create user and database 6. Browse to site and let WordPress configure everything
<VirtualHost MyLocalSite.dev:80>
ServerAdmin postmaster @ MyLocalSite.dev
DocumentRoot "C:/xampp/htdocs/MyLocalSite.dev"
ServerName MyLocalSite.dev
ServerAlias www.MyLocalSite.dev
ErrorLog "logs/MyLocalSite.dev-error.log"
CustomLog "logs/MyLocalSite.dev-access.log" combined
</VirtualHost>
@angeliquejw
angeliquejw / WPbodyclass_browserID.php
Last active December 20, 2015 06:58
Add browser classes to the BODY of a WordPress site. Not necessary if you're already using Modernizr or another solution.
<?php
add_filter('body_class','browser_body_class');
function browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
@angeliquejw
angeliquejw / WPbodyclass_pageslug.php
Created July 26, 2013 14:50
Add page slugs to the WordPress BODY class.
<?php
add_filter( 'body_class', 'add_slug_body_class' );
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
?>
@angeliquejw
angeliquejw / wp_trim_cfield.php
Created August 20, 2013 20:20
Trim custom field in WordPress
<?php
$trim_length = 25; //desired length of text to display
$value_more = '(&hellip;)'; // what to add at the end of the trimmed text
$custom_field = 'my-custom-field-name';
$value = get_post_meta($post->ID, $custom_field, true);
if ($value) {
echo wp_trim_words( $value, $trim_length, $value_more);
}
?>
@angeliquejw
angeliquejw / gist:7034866
Created October 18, 2013 00:56 — forked from sareiodata/gist:4307554
WP menus that switch based on if user is logged in or not
/**
* Register menus in functions.php
*/
register_nav_menus( array(
'logged-in' => __( 'Logged-in Menu Area', 'yourtheme' ),
'visitor' => __( 'Visitor Menu Area', 'yourtheme' ),
));