Skip to content

Instantly share code, notes, and snippets.

View epicdaze's full-sized avatar

Daze epicdaze

View GitHub Profile
@epicdaze
epicdaze / gist:1033276
Created June 18, 2011 16:58
#wordpress - add google analytics exclusion cookie to page when logged in as admin #analytics #exclude #cookie #admin
<!-- /* add a google analytics exclusion cookie to the blog when logged in as admin (or other role) */ -->
<!-- /* edit the <body> tag in header.php */ -->
<body <?php body_class(); ?>>
<!-- /* replace with this line: */ -->
<body <?php if (current_user_can('manage_options')) {echo 'onLoad="javascript:pageTracker._setVar(\'test_value\');" ';} body_class(); ?>>
<!-- /*
to change the role to which this cookie is served, change the capability in (current_user_can('capability')) to one of these:
@epicdaze
epicdaze / gist:1055013
Created June 29, 2011 21:18
#wordpress - add excerpts to pages #function #excerpts
<!-- /* Add excerpt functionality to pages. From: http://wordpress.mfields.org/2010/excerpts-for-pages-in-wordpress-3-0/ */ -->
<?php add_post_type_support( 'page', 'excerpt' ); ?>
<!-- /* To activate, click on the ‘screen options’ tab near the top right when editing a page. There is a checkbox for Excerpts. */ -->
@epicdaze
epicdaze / gist:1059498
Created July 1, 2011 22:02
#wordpress - return the post tags and strip whitespace from each #tags #whitespace
<!-- /* http://wordpress.stackexchange.com/questions/21707/ */ -->
<?php
$tags = get_the_tags();
$tag_links = array();
foreach((array)$tags as $tag)
$tag_links[] = str_replace(' ', '', $tag->name);
@epicdaze
epicdaze / gist:1059744
Created July 2, 2011 04:47
#wordpress - tweet button with hashtags #twitter #tags #hashtags #whitespace
<!-- /* Twitter button: post title and post tags. Prepend tags with hash symbol and remove whitespace within tags. */ -->
<a href="http://twitter.com/share"
class="twitter-share-button"
data-url="<?php bloginfo('url'); ?>/<?php the_ID(); ?>"
data-text="<?php the_title();
// remove whitespace inside tags and prepend with #
$tags = get_the_tags();
$tags_hashed = array();
foreach((array)$tags as $tag)
@epicdaze
epicdaze / gist:1062523
Created July 3, 2011 19:24
#wordpress - valid twitter share button #twitter #share #tags #documentwrite #whitespace
<!-- /* customized and valid twitter share button using asynchronous document.write */ -->
<!-- /* inspired from http://techoctave.com/c7/posts/40 and gist:1059744 and gist:1059498 */ -->
<script type="text/javascript">
//<![CDATA[
(function() {
document.write('<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="twitter_username" '
+'data-text=\'Article#<?php the_ID(); echo": "; the_title(); $tags = get_the_tags(); $tags_hashed = array(); foreach((array)$tags as $tag) $tags_hashed[] = str_replace(" ", "", $tag->name); echo " #".implode(" #", $tags_hashed); ?>\' '
+'data-url="<?php bloginfo('url'); ?>/<?php the_ID(); ?>" data-lang="en">Tweet this</a> ');
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
@epicdaze
epicdaze / gist:1155551
Created August 18, 2011 23:34
#gmail - hide ads #stylish
/* hide sidebar on the right */
.diLZtc .Bu + .Bu + .Bu {display: none !important;}
@epicdaze
epicdaze / gist:1155554
Created August 18, 2011 23:37
#gmail - larger labels #stylish
/* make labels larger in gmail when using "Preview (Dense)" theme */
/* main view */
.ar {font-size: 11px !important;}
/* single view */
.ha .cf .hM {font-size: 11px !important;}
@epicdaze
epicdaze / gist:1155557
Created August 18, 2011 23:40
#gmail - shorter height for logo section #stylish
/* reduce height of logo section in gmail when using "Preview (Dense)" theme */
div.nH.GcwpPb-Z8OBDd > div.nH {height: 40px;}
div.nH.GcwpPb-Z8OBDd > div.nH > div.no {height: 40px !important; margin-top: -25px;}
@epicdaze
epicdaze / gist:1155558
Created August 18, 2011 23:40
#google - hide instant preview #stylish
/* hide instant preview */
/*
apply to these domains:
encrypted.google.com
google.ca
www.google.ca
google.com
www.google.com
*/
@epicdaze
epicdaze / gist:1155680
Created August 19, 2011 00:14
#twitter - expand latest tweet #stylish
/* when logged in, expand latest tweet instead of truncated version */
div.latest-tweet .tweet-content,
div.latest-tweet .tweet-row,
div.truncated-tweet .tweet-row {height: 60px !important;}
div.latest-tweet .tweet-row, div.truncated-tweet .tweet-row {white-space: normal !important;}