Skip to content

Instantly share code, notes, and snippets.

View epicdaze's full-sized avatar

Daze epicdaze

View GitHub Profile
@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;}
@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: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: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: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:1032786
Created June 18, 2011 03:59
#wordpress - enable adminbar in custom theme #theme #adminbar
<!-- /* this should placed in header.php in the <head> section (if it isn’t already) to enable plugins and admin bar functionality */ -->
<?php wp_head();?>
<!-- /* this should be placed in footer.php right before </body> to insert the actual html for the admin bar */ -->
<?php wp_footer(); ?>
@epicdaze
epicdaze / gist:1030943
Created June 17, 2011 06:11
#wordpress - remove wordpress version number #obfuscate #version
<!-- /* Remove version number from wordpress generated source and RSS feed.
http://www.wpbeginner.com/wp-tutorials/the-right-way-to-remove-wordpress-version-number/
*/ -->
<!-- /* remove this from header.php remove version from generated page source */ -->
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<!-- /* or add this to functions.php to remove version from generated page source */ -->
<?php remove_action('wp_head', 'wp_generator'); ?>
@epicdaze
epicdaze / gist:1029717
Created June 16, 2011 17:13
#wordpress - load child theme language files #language #localization #L10n #childtheme
<!-- /* To load language files from a subfolder in a theme child, add this in its functions.php file: */ -->
<?php
load_child_theme_textdomain('parentThemeFolderName', dirname(__FILE__).'/languageSubfolderNameInChildTheme');
?>
@epicdaze
epicdaze / gist:1028544
Created June 16, 2011 02:04
#wordpress - display published post count #postcount #post #count
<!-- /* This simple one line snippet will display the total wordpress post count. */ -->
<?php echo wp_count_posts()->publish; ?>
@epicdaze
epicdaze / gist:1026324
Created June 15, 2011 01:38
#wordpress - add nofollow to comments link #comments #attribute #nofollow
<!-- /* add this to the theme's functions.php to add rel="nofollow" atribute to comments link */ -->
<?php function add_nofollow_to_comments_popup_link ()
{ return 'rel="nofollow"'; }
add_filter ( 'comments_popup_link_attributes', 'add_nofollow_to_comments_popup_link' );
?>