Skip to content

Instantly share code, notes, and snippets.

View colorful-tones's full-sized avatar
💓
Don’t believe the hype!

Damon Cook colorful-tones

💓
Don’t believe the hype!
View GitHub Profile
@colorful-tones
colorful-tones / DRY-SASS.scss
Last active August 29, 2015 14:04
How do I make this into nice SASS mixin? with @extend?
/* COLORS FOR CAR Types */
$mini-van-base: #344556; //blue
$sedan-base: #b43d3d; //red
$suv-base: #7a4c8e; //purple
$truck-base: #d0922f; //yellow
$convertible-base: #ff5831; //orange
@each $car_type, $color in
( mini-van, $mini-van-base ),
( sedan, $sedan-base ),
@colorful-tones
colorful-tones / gravity-forms.php
Last active August 29, 2015 14:18
Gravity Forms overrides I typically need to use. I like to put this in _s /inc/, and don't forget to put this in your functions.php: ```require get_template_directory() . '/inc/gravity-forms.php';```
<?php
/**
* Maintainn Gravity Forms Hooks & Filter overrides
*
*/
/*
* Filter the Gravity Forms button type and add your own .class
*/
function your_prefix_form_submit_button( $button, $form ) {
// Usage:
// get_id_by_slug( 'any-page-slug' );
function get_id_by_slug( $page_slug ) {
$page = get_page_by_path( $page_slug );
if ( $page ) {
return $page->ID;
} else {
return null;
( function($) {
var menuToggle = $('.menu-toggle');
var overlay = $('.overlay');
var closeButton = $('.overlay-close');
var searchToggle = $('.search-toggle');
var searchForm = $('.search-form');
var ww = window.innerWidth;
@colorful-tones
colorful-tones / remove_capital_P_dangit.php
Created March 8, 2012 19:44
remove capital_P_dangit funtion
<?php
// Remove the capital_P_dangit function from Wordpress
// place in your themes' functions.php file, or
// better yet make a plugin and keep functionality
// out of your themes.
remove_filter( 'the_title', 'capital_P_dangit', 11 );
remove_filter( 'the_content', 'capital_P_dangit', 11 );
remove_filter( 'comment_text', 'capital_P_dangit', 31 );
@colorful-tones
colorful-tones / .htaccess
Last active October 16, 2015 14:59 — forked from gregrickaby/example-nginx.conf
redirect /uploads/ folder for dev
# Apache .htaccess
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
# Nginx
location ~ ^/wp-content/uploads/(.*) {
rewrite ^/wp-content/uploads/(.*)$ http://livewebsite.com/wp-content/uploads/$1 redirect;
}
@colorful-tones
colorful-tones / .htaccess
Created April 24, 2013 15:39
enable gzip compression via .htaccess for WordPress sites. Make sure gzip compression is enabled on server first, otherwise it is useless.
# START enable gzip compression
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
@colorful-tones
colorful-tones / wds-back-to-top.js
Created December 17, 2015 21:43 — forked from gregrickaby/wds-back-to-top.js
WDS Javascript Back To Top
/**
* Back To Top.
*/
window.Back_To_Top = {};
( function( window, $, that ) {
// Private variables.
var minWidth = 768;
var minHeight = 200;
@colorful-tones
colorful-tones / Hide WP Admin Menus
Created June 11, 2013 14:36
Hide WordPress admin menu items from everybody but Super Admin. Helpful for hiding 'Posts' and 'Comments' menu items when client isn't using blog. Change unfiltered_html to install_plugins if you want to all Admins access to menu items too, etc.
// hide the Posts and Comments menu items from ALL roles except Super Admin
// https://codex.wordpress.org/Roles_and_Capabilities
function remove_menus () {
global $menu;
if( (current_user_can('unfiltered_html')) ) { $restricted = array(__()); }
else { $restricted = array( __('Posts'),__('Comments')); } // hide these for other roles
end ($menu);
while (prev($menu)) {
$value = explode(' ',$menu[key($menu)][0]);
@colorful-tones
colorful-tones / conditional-sidebar
Created June 11, 2013 14:46
Conditional sidebar logic for WordPress page. http://stackoverflow.com/questions/10486895/wordpress-conditional-sidebar-section-based-off-of-page-id conditional logic for custom sidebar… place it in page.php or even index.php to replace get_sidebar()
<?php
// make sure any child pages inherit sidebar properties
$ancestors = array_reverse(get_ancestors(get_the_ID(), 'page'));
$top_page = $ancestors ? get_page($ancestors[0]) : get_page(get_the_ID());
/*
check to see if a custom sidebar exists for our page based on
the page's slug, like a page named "About Us" would have sidebar-about-us.php
*/
if(locate_template('sidebar-'.$top_page->post_name.'.php'))