Skip to content

Instantly share code, notes, and snippets.

@jamiew
Created April 19, 2010 16:58
Show Gist options
  • Save jamiew/371288 to your computer and use it in GitHub Desktop.
Save jamiew/371288 to your computer and use it in GitHub Desktop.
<?php
// Add some dope ASCII art to yr blog, dynamically generated via `figlet`
//
// I'm using some cool custom figlet fonts you may or may not have -- check 'showfigfonts`
// Toss this into your theme's index.php and/or archive.php
// Also, you'll want to cache this -- try WPSuperCache
// --jdubs <http://jamiedubs.com> | FAT <http://fffff.at>
if(is_category() || is_tag()) {
print '<div class="ascii-art"><pre>'."\n";
$current_category = str_replace('"', '', single_cat_title("", false));
$fonts = array('crawford', 'cosmic', 'cosmike', 'utopiab', 'univers', 'roman', 'poison', 'epic', 'colossal');
$font = $fonts[floor(rand() % count($fonts))];
print system("figlet -w 140 -S -f $font \"$current_category\"");
print "\n<!-- figlet font: $font -->\n";
print '</pre></div>'."\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment