'2c-l', ); $options = array_merge($defaults, (array) get_option('sandbox_options')); if ( isset($options[$name]) ) return $options[$name]; return false; } // Andy really goes nuts with arrays, which has been a good thing. Very good. function sandbox_set_options($new_options) { $options = (array) get_option('sandbox_options'); $options = array_merge($options, (array) $new_options); return update_option('sandbox_options', $options); } // Template tag: echoes a stylesheet link if one is selected function sandbox_stylesheets() { $skin = sandbox_get_option('skin'); if ( strtolower(get_current_theme()) !== 'sandbox 0.6.1' ) { ?> " title="Sandbox" /> '.__('Skip navigation', 'sandbox').'

'; } // Template tag: echoes a page list for navigation if the // global_navigation option is set to "Y" in the skin file function sandbox_globalnav() { if ( !sandbox_get_option('globalnav') ) return; echo ""; } // Template tag: echoes semantic classes in the function sandbox_body_class( $print = true ) { global $wp_query, $current_user; $c = array('wordpress'); sandbox_date_classes(time(), $c); is_home() ? $c[] = 'home' : null; is_archive() ? $c[] = 'archive' : null; is_date() ? $c[] = 'date' : null; is_search() ? $c[] = 'search' : null; is_paged() ? $c[] = 'paged' : null; is_attachment() ? $c[] = 'attachment' : null; is_404() ? $c[] = 'four04' : null; // CSS does not allow a digit as first character if ( is_single() ) { the_post(); $c[] = 'single'; if ( isset($wp_query->post->post_date) ) sandbox_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-'); foreach ( (array) get_the_category() as $cat ) $c[] = 's-category-' . $cat->category_nicename; $c[] = 's-author-' . get_the_author_login(); rewind_posts(); } else if ( is_author() ) { $author = $wp_query->get_queried_object(); $c[] = 'author'; $c[] = 'author-' . $author->user_nicename; } else if ( is_category() ) { $cat = $wp_query->get_queried_object(); $c[] = 'category'; $c[] = 'category-' . $cat->category_nicename; } else if ( is_page() ) { the_post(); $c[] = 'page'; $c[] = 'page-author-' . get_the_author_login(); rewind_posts(); } if ( $current_user->ID ) $c[] = 'loggedin'; $c = implode(' ', apply_filters('body_class', $c)); return $print ? print($c) : $c; } // Template tag: echoes semantic classes in each post
function sandbox_post_class( $print = true ) { global $post, $sandbox_post_alt; $c = array("p$sandbox_post_alt", $post->post_status); $c[] = 'author-' . get_the_author_login(); sandbox_date_classes(mysql2date('U', $post->post_date), $c); if ( ++$sandbox_post_alt % 2 ) $c[] = 'alt'; $c = implode(' ', get_post_class( $c, $post->ID )); return $print ? print($c) : $c; } $sandbox_post_alt = 1; // Template tag: echoes semantic classes for a comment
  • function sandbox_comment_class( $print = true ) { global $comment, $post, $sandbox_comment_alt; $c = array($comment->comment_type, "c$sandbox_comment_alt"); if ( $comment->user_id > 0 ) { $user = get_userdata($comment->user_id); $c[] = "byuser commentauthor-$user->user_login"; if ( $comment->user_id === $post->post_author ) $c[] = 'bypostauthor'; } sandbox_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-'); if ( 0 == ++$sandbox_comment_alt % 2 ) $c[] = 'alt'; if ( is_trackback() ) { $c[] = 'trackback'; } $c = implode( ' ', apply_filters( 'comment_class', $c, array(), $comment->comment_ID, $comment, $post ) ); return $print ? print($c) : $c; } // Adds four time- and date-based classes to an array // with all times relative to GMT (sometimes called UTC) function sandbox_date_classes($t, &$c, $p = '') { $gmt_offset = get_settings( 'gmt_offset' ); if ( empty( $gmt_offset ) ) { $gmt_offset = 0; } $t = $t + ( $gmt_offset * 3600 ); $c[] = $p . 'y' . gmdate('Y', $t); // Year $c[] = $p . 'm' . gmdate('m', $t); // Month $c[] = $p . 'd' . gmdate('d', $t); // Day $c[] = $p . 'h' . gmdate('h', $t); // Hour } // Returns a list of the post's categories, minus the queried one function sandbox_cats_meow($glue) { $current_cat = single_cat_title('', false); $separator = "\n"; $cats = explode($separator, get_the_category_list($separator)); foreach ( $cats as $i => $str ) { if ( strstr($str, ">$current_cat<") ) { unset($cats[$i]); break; } } if ( empty($cats) ) return false; return trim(implode($glue, $cats)); } // Sandbox widgets: Replaces the default search widget with one // that matches what is in the Sandbox sidebar by default function widget_sandbox_search($args) { extract($args); if ( empty($title) ) $title = __('Search', 'sandbox'); ?>

    except the home.', 'sandbox'); ?>

    '

    ', 'title_after'=>'

    ', 'show_images'=>true)); } // Sandbox skins menu: creates the array to collect // information from the skins currently installed function sandbox_skin_info($skin) { $info = array( 'skin_name' => $skin, 'skin_uri' => '', 'description' => '', 'version' => '1.0', 'author' => __('Anonymous', 'sandbox'), 'author_uri' => '', 'global_navigation' => 'Y', ); if ( !file_exists(get_template_directory()."/skins/$skin.css") ) return array(); $css = (array) file(get_template_directory()."/skins/$skin.css"); foreach ( $css as $line ) { if ( strstr($line, '*/') ) return $info; if ( !strstr($line, ':') ) continue; list ( $k, $v ) = explode(':', $line, 2); $k = str_replace(' ', '_', strtolower(trim($k))); if ( array_key_exists($k, $info) ) $info[$k] = stripslashes(wp_filter_kses(trim($v))); } } // Sandbox skins menu: Registers the workings of the skins menu function sandbox_admin_skins() { $skins = array(); if ( isset ( $_GET['message'] ) ) { switch ( $_GET['message'] ) { case 'updated' : echo "\n

    ".__('Sandbox skin saved successfully.', 'sandbox')."

    \n"; break; } } $current_skin = sandbox_get_option('skin'); $_skins = glob(get_template_directory().'/skins/*.css'); foreach ( $_skins as $k => $v ) { $info = array(); preg_match('/\/([^\/]+).css$/i', $v, $matches); if ( !empty($matches[1]) ) { $skins[$matches[1]] = sandbox_skin_info($matches[1]); } } ?>

    " alt="" /> $skin_name"; if ( !empty($author_uri) ) $author = "$author"; ?>

    $info ) : if ( $skin == $current_skin || !is_array($info) ) continue; extract($info); $activate_link = "themes.php?page=theme_options&action=activate&skin=$skin"; // wp_nonce_url first introduced in WP 2.0.3 if ( function_exists('wp_nonce_url') ) $activate_link = wp_nonce_url($activate_link, 'switch-skin_' . $skin); ?>
    wp_filter_kses($_GET['skin']), 'globalnav' => bool_from_yn($info['global_navigation']) )); wp_redirect('themes.php?page=theme_options&message=updated'); } } // Sandbox skins menu: tells WordPress (nicely) to load the skins menu function sandbox_admin_menu() { add_theme_page(__('Theme Options', 'sandbox'), __('Theme Options', 'sandbox'), 'edit_theme_options', 'theme_options', 'sandbox_admin_skins'); } // Sandbox widgets: initializes Widgets for the Sandbox function sandbox_widgets_init() { // Overrides the Widgets default and uses

    's for sidebar headings $p = array( 'before_title' => "

    ", 'after_title' => "

    \n", ); // How many? Two?! That's it? register_sidebars(2, $p); // Registers the widgets specific to the Sandbox, as set earlier unregister_widget('WP_Widget_Search'); wp_register_sidebar_widget('search', __('Search', 'sandbox'), 'widget_sandbox_search'); unregister_widget('WP_Widget_Meta'); wp_register_sidebar_widget('meta', __('Meta', 'sandbox'), 'widget_sandbox_meta'); unregister_widget('WP_Widget_Links'); wp_register_sidebar_widget('links', __('Links', 'sandbox'), 'widget_sandbox_links'); wp_register_sidebar_widget('home-link', __('Home Link', 'widgets'), 'widget_sandbox_homelink'); wp_register_widget_control('home-link', __('Home Link', 'widgets'), 'widget_sandbox_homelink_control'); wp_register_sidebar_widget('rss-links', __('RSS Links', 'widgets'), 'widget_sandbox_rsslinks'); wp_register_widget_control('rss-links', __('RSS Links', 'widgets'), 'widget_sandbox_rsslinks_control'); } // Runs our code at the end to check that everything needed has loaded add_action('init', 'sandbox_init', 1); add_action('widgets_init', 'sandbox_widgets_init'); add_action('admin_menu', 'sandbox_admin_menu'); // Adds filters for greater compliance add_filter('archive_meta', 'wptexturize'); add_filter('archive_meta', 'convert_smilies'); add_filter('archive_meta', 'convert_chars'); add_filter('archive_meta', 'wpautop'); add_theme_support( 'automatic-feed-links' ); add_custom_background(); /** * Set a default theme color array for WP.com. */ $themecolors = array( 'bg' => 'ffffff', 'border' => 'eeeeee', 'text' => '444444', ); function sandbox_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); ?>
  • id="comment-">
    comment_approved == '0') : ?>
    | Permalink', 'sandbox'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID() ); ?>
    'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  • id="comment-">
    comment_approved == '0') _e('Your trackback/pingback is awaiting moderation.', 'sandbox') ?>

    Howdy! There's a new version of the Sandbox theme you’re using on this blog—now with the new custom menu feature. Check out Sandbox 1.6.2 in Appearance → Themes.