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 / update-WP-URLs
Created June 11, 2013 14:49
Update URLs in WordPress database when migrating from dev to production. One way of doing it at least ;)
UPDATE `wp_posts` SET guid = REPLACE(guid, 'http://YOURSITE.sites.mannixmarketing.com', 'http://www.CLIENTSITE.com');
UPDATE `wp_posts` SET post_content = REPLACE(post_content, 'http://YOURSITE.sites.mannixmarketing.com', 'http://www.CLIENTSITE.com');
Modernizr.load([{
// Test
test: Modernizr.cssanimations,
// If yes:
yep: {
'yesResponse': '/css/yes.css'
},
// If no:
nope: {
'noResponse': ['/js/yes.js', '/css/yes.css']
@colorful-tones
colorful-tones / Create-db
Created June 11, 2013 14:53
Create MySQL db
create database 'yourdbname';
@colorful-tones
colorful-tones / 301 & www .htaccess
Created June 11, 2013 14:56
301 & www .htaccess
RewriteEngine On
RewriteBase /
#RewriteCond %{HTTP_HOST} !^www.harmony-group.com [NC]
#RewriteRule ^(.*)$ http://www.harmony-group.com/$1 [L,R=301]
RewriteRule ^about.html /about-us/ [L,R=301]
RewriteRule ^residential.html /luxury-apartments/ [L,R=301]
RewriteRule ^commercial.html /luxury-office-space/ [L,R=301]
RewriteRule ^storage.html /self-storage-facilities/ [L,R=301]
@colorful-tones
colorful-tones / jQuery CDN w fallback
Created June 11, 2013 14:59
Grab jQuery library from Google's CDN if failed then pull local version
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
@colorful-tones
colorful-tones / Post Type conditional
Created June 11, 2013 15:01
Check if Post Type inside or outside of loop
<?php
/*
This allows us to be able to use conditional
to check whether is_post_type = "your custom post type here"
And can be used inside OR outside the loop
*/
function is_post_type($type){
global $wp_query;
if($type == get_post_type($wp_query->post->ID)) return true;
return false;
@colorful-tones
colorful-tones / custom-post-type-query
Created June 19, 2013 20:48
Custom Post Type query
<!-- Custom Post Type Loop -->
<?php $query = new WP_Query(array(
'post_type' => 'testimonials',
'posts_per_page' => -1,
'orderby' => 'rand'
));
while ( $query->have_posts() ) : $query->the_post();
echo '<div class="custompost">';
the_content();
@colorful-tones
colorful-tones / wds-javascript-style.js
Created February 10, 2016 18:07 — forked from gregrickaby/wdsjQuery.js
WDS Javascript Style
/**
* Foo Script.
*/
window.Foo_Object = {};
( function( window, $, that ) {
// Private variable.
var fooVariable = 'foo';
// Constructor.
@colorful-tones
colorful-tones / mobile-detect.min.js
Last active May 20, 2016 00:42
Javascript user agent sniffing (don't recommend trying it, but)... #mobile
/*
* JS Redirection Mobile
*
* Developed by
* Sebastiano Armeli-Battana (@sebarmeli) - http://www.sebastianoarmelibattana.com
* Dual licensed under the MIT or GPL Version 3 licenses.
* @version 0.9.5
*/
if(!window.SA){window.SA={};}SA.redirection_mobile=function(m){var c=function(y){var x=new Date();x.setTime(x.getTime()+y);return x;};var q=function(C){if(!C){return;}var x=document.location.search,D=x&&x.substring(1).split("&"),z=0,B=D.length;for(;z<B;z++){var y=D[z],A=y&&y.substring(0,y.indexOf("="));if(A===C){return y.substring(y.indexOf("=")+1,y.length);}}};var a=navigator.userAgent.toLowerCase(),s="false",f="true",w=m||{},r=w.noredirection_param||"noredirection",t=w.mobile_prefix||"m",o=w.mobile_url,d=w.mobile_scheme?w.mobile_scheme+":":document.location.protocol,p=document.location.host,i=q(r),j=o||(t+"."+(!!p.match(/^www\./i)?p.substring(4):p)),k=w.cookie_hours||1,g=w.keep_path||false,v=w.keep_query||false,h=w.tablet_url||j,b=!!(a.match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|o
function bp_rename_profile_tabs() {
buddypress()->members->nav->edit_nav( array(
'name' => __( 'Dashboard', 'textdomain' ),
'slug' => __( 'dashboard', 'textdomain' )
), 'activity' );
}
add_action( 'bp_actions', 'bp_rename_profile_tabs' );