"; if ( !is_front_page() ) { ?>
  • \n"; } // Produces an hCard for the "admin" user function blogtxt_admin_hCard() { global $wpdb, $admin_info; $admin_info = get_userdata(1); echo '' . $admin_info->first_name . ' ' . $admin_info->last_name . ''; } // Produces an hCard for post authors function blogtxt_author_hCard() { global $wpdb, $authordata; echo '' . get_the_author() . ''; } // Produces semantic classes for the body element; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_body_class( $print = true ) { global $wp_query, $current_user; $c = array('wordpress'); blogtxt_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; if ( is_single() ) { the_post(); $c[] = 'single'; if ( isset($wp_query->post->post_date) ) blogtxt_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(); } elseif ( is_author() ) { $author = $wp_query->get_queried_object(); $c[] = 'author'; $c[] = 'author-' . $author->user_nicename; } elseif ( is_category() ) { $cat = $wp_query->get_queried_object(); $c[] = 'category'; $c[] = 'category-' . $cat->category_nicename; } elseif ( is_page() ) { the_post(); $c[] = 'page'; $c[] = 'page-author-' . get_the_author_login(); rewind_posts(); } if ( $current_user->ID ) $c[] = 'loggedin'; $c = join(' ', apply_filters('body_class', $c)); return $print ? print($c) : $c; } // Produces semantic classes for the each individual post div; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_post_class( $print = true ) { global $post, $blogtxt_post_alt; $c = array('hentry', "p$blogtxt_post_alt", $post->post_type, $post->post_status); $c[] = 'author-' . get_the_author_login(); if ( is_attachment() ) $c[] = 'attachment'; foreach ( (array) get_the_category() as $cat ) $c[] = 'category-' . $cat->category_nicename; blogtxt_date_classes(mysql2date('U', $post->post_date), $c); if ( ++$blogtxt_post_alt % 2 ) $c[] = 'alt'; $c = join(' ', apply_filters('post_class', $c)); return $print ? print($c) : $c; } $blogtxt_post_alt = 1; // Produces semantic classes for the each individual comment li; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_comment_class( $print = true ) { global $comment, $post, $blogtxt_comment_alt; $c = array($comment->comment_type); 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'; } blogtxt_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-'); if ( ++$blogtxt_comment_alt % 2 ) $c[] = 'alt'; $c[] = "c$blogtxt_comment_alt"; if ( is_trackback() ) { $c[] = 'trackback'; } $c = join(' ', apply_filters('comment_class', $c)); return $print ? print($c) : $c; } // Produces date-based classes for the three functions above; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_date_classes($t, &$c, $p = '') { $t = $t + (get_option('gmt_offset') * 3600); $c[] = $p . 'y' . gmdate('Y', $t); $c[] = $p . 'm' . gmdate('m', $t); $c[] = $p . 'd' . gmdate('d', $t); $c[] = $p . 'h' . gmdate('h', $t); } // Returns other categories except the current one (redundant); Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_other_cats($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(join($glue, $cats)); } // Returns other tags except the current one (redundant); Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/ function blogtxt_other_tags($glue) { $current_tag = single_tag_title('', '', false); $separator = "\n"; $tags = explode($separator, get_the_tag_list("", "$separator", "")); foreach ( $tags as $i => $str ) { if ( strstr($str, ">$current_tag<") ) { unset($tags[$i]); break; } } if ( empty($tags) ) return false; return trim(join($glue, $tags)); } // Produces an avatar image with the hCard-compliant photo class function blogtxt_commenter_link() { $commenter = get_comment_author_link(); if ( ereg( ']* class=[^>]+>', $commenter ) ) { $commenter = ereg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = ereg_replace( '(' . $commenter . ''; } // Function to filter the default gallery shortcode function blogtxt_gallery($attr) { global $post; if ( isset($attr['orderby']) ) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if ( !$attr['orderby'] ) unset($attr['orderby']); } extract(shortcode_atts( array( 'orderby' => 'menu_order ASC, ID ASC', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', ), $attr )); $id = intval($id); $orderby = addslashes($orderby); $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}"); if ( empty($attachments) ) return null; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $id => $attachment ) $output .= wp_get_attachment_link( $id, $size, true ) . "\n"; return $output; } $listtag = tag_escape($listtag); $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $output = apply_filters( 'gallery_style', "\n" . '
    ', 9 ); // Available filter: gallery_style foreach ( $attachments as $id => $attachment ) { $img_lnk = get_attachment_link($id); $img_src = wp_get_attachment_image_src( $id, $size ); $img_src = $img_src[0]; $img_alt = $attachment->post_excerpt; if ( $img_alt == null ) $img_alt = $attachment->post_title; $img_rel = apply_filters( 'gallery_img_rel', 'attachment' ); // Available filter: gallery_img_rel $img_class = apply_filters( 'gallery_img_class', 'gallery-image' ); // Available filter: gallery_img_class $output .= "\n\t" . '<' . $itemtag . ' class="gallery-item gallery-columns-' . $columns .'">'; $output .= "\n\t\t" . '<' . $icontag . ' class="gallery-icon">' . $img_alt . ''; if ( $captiontag && trim($attachment->post_excerpt) ) { $output .= "\n\t\t" . '<' . $captiontag . ' class="gallery-caption">' . $attachment->post_excerpt . ''; } $output .= "\n\t" . ''; if ( $columns > 0 && ++$i % $columns == 0 ) $output .= "\n
    \n" . '
    '; } $output .= "\n
    \n"; return $output; } // Loads a blog.txt-style Search widget function widget_blogtxt_search($args) { extract($args); $options = get_option('widget_blogtxt_search'); $title = empty($options['title']) ? __( 'Blog Search', 'blogtxt' ) : $options['title']; $button = empty($options['button']) ? __( 'Find', 'blogtxt' ) : $options['button']; ?>

    • ©
    • WordPress', 'blogtxt') ?>
    • XHTML & CSS', 'blogtxt'), get_bloginfo('stylesheet_url') ); ?>

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

    get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID, SUBSTRING(comment_content,1,65) AS comment_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT $count"); ?>
      ' . sprintf(__('%1$s on %2$s
      %4$s …
      '), '' . $comment->comment_author . '', get_the_title($comment->comment_post_ID), get_permalink($comment->comment_post_ID), strip_tags($comment->comment_excerpt) ) . ''; endforeach; endif;?>


    "

    ", 'after_title' => "

    \n", ); register_sidebars(2, $p); // Finished intializing Widgets plugin, now let's load the blog.txt default widgets; first, blog.txt search widget $widget_ops = array( 'classname' => 'widget_search', 'description' => __( "A search form for your blog (blog.txt)", "blogtxt" ) ); wp_register_sidebar_widget( 'search', __( 'Search', 'blogtxt' ), 'widget_blogtxt_search', $widget_ops ); unregister_widget_control('search'); wp_register_widget_control( 'search', __( 'Search', 'blogtxt' ), 'widget_blogtxt_search_control' ); // blog.txt Meta widget $widget_ops = array( 'classname' => 'widget_meta', 'description' => __( "Log in/out and administration links (blog.txt)", "blogtxt" ) ); wp_register_sidebar_widget( 'meta', __( 'Meta', 'blogtxt' ), 'widget_blogtxt_meta', $widget_ops ); unregister_widget_control('meta'); wp_register_widget_control( 'meta', __('Meta'), 'wp_widget_meta_control' ); //blog.txt Home Link widget $widget_ops = array( 'classname' => 'widget_home_link', 'description' => __( "Link to the front page when elsewhere (blog.txt)", "blogtxt" ) ); wp_register_sidebar_widget( 'home_link', __( 'Home Link', 'blogtxt' ), 'widget_blogtxt_homelink', $widget_ops ); wp_register_widget_control( 'home_link', __( 'Home Link', 'blogtxt' ), 'widget_blogtxt_homelink_control' ); //blog.txt Recent Comments widget $widget_ops = array( 'classname' => 'widget_blogtxt_recent_comments', 'description' => __( "Semantic recent comments (blog.txt)", "blogtxt" ) ); wp_register_sidebar_widget( 'blogtxt-recent-comments', __( 'Recent Comments', 'blogtxt' ), 'widget_blogtxt_recent_comments', $widget_ops ); wp_register_widget_control( 'blogtxt-recent-comments', __( 'Recent Comments', 'blogtxt' ), 'widget_blogtxt_recent_comments_control' ); //blog.txt RSS Links widget $widget_ops = array( 'classname' => 'widget_rss_links', 'description' => __( "RSS links for both posts and comments (blog.txt)", "blogtxt" ) ); wp_register_sidebar_widget( 'rss_links', __( 'RSS Links', 'blogtxt' ), 'widget_blogtxt_rsslinks', $widget_ops ); wp_register_widget_control( 'rss_links', __( 'RSS Links', 'blogtxt' ), 'widget_blogtxt_rsslinks_control' ); } // Loads the admin menu; sets default settings for each function blogtxt_add_admin() { if ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { check_admin_referer('blogtxt_save_options'); update_option( 'blogtxt_authorlink', strip_tags( stripslashes( $_REQUEST['bt_authorlink'] ) ) ); update_option( 'blogtxt_basefontfamily', strip_tags( stripslashes( $_REQUEST['bt_basefontfamily'] ) ) ); update_option( 'blogtxt_basefontsize', strip_tags( stripslashes( $_REQUEST['bt_basefontsize'] ) ) ); update_option( 'blogtxt_blogtitlefontfamily', strip_tags( stripslashes( $_REQUEST['bt_blogtitlefontfamily'] ) ) ); update_option( 'blogtxt_headingfontfamily', strip_tags( stripslashes( $_REQUEST['bt_headingfontfamily'] ) ) ); update_option( 'blogtxt_layoutalignment', strip_tags( stripslashes( $_REQUEST['bt_layoutalignment'] ) ) ); update_option( 'blogtxt_layouttype', strip_tags( stripslashes( $_REQUEST['bt_layouttype'] ) ) ); update_option( 'blogtxt_layoutwidth', strip_tags( stripslashes( $_REQUEST['bt_layoutwidth'] ) ) ); update_option( 'blogtxt_miscfontfamily', strip_tags( stripslashes( $_REQUEST['bt_miscfontfamily'] ) ) ); update_option( 'blogtxt_posttextalignment', strip_tags( stripslashes( $_REQUEST['bt_posttextalignment'] ) ) ); update_option( 'blogtxt_avatarsize', strip_tags( stripslashes( $_REQUEST['bt_avatarsize'] ) ) ); header("Location: themes.php?page=functions.php&saved=true"); die; } elseif ( 'reset' == $_REQUEST['action'] ) { check_admin_referer('blogtxt_reset_options'); delete_option('blogtxt_authorlink'); delete_option('blogtxt_basefontfamily'); delete_option('blogtxt_basefontsize'); delete_option('blogtxt_blogtitlefontfamily'); delete_option('blogtxt_headingfontfamily'); delete_option('blogtxt_layoutalignment'); delete_option('blogtxt_layouttype'); delete_option('blogtxt_layoutwidth'); delete_option('blogtxt_miscfontfamily'); delete_option('blogtxt_posttextalignment'); delete_option('blogtxt_avatarsize'); header("Location: themes.php?page=functions.php&reset=true"); die; } add_action('admin_head', 'blogtxt_admin_head'); } add_theme_page( __( 'Blog.txt Theme Options', 'blogtxt' ), __( 'Theme Options', 'blogtxt' ), 'edit_themes', basename(__FILE__), 'blogtxt_admin' ); } function blogtxt_donate() { $form = '
    Donate with PayPal
    ' . "\n\t"; echo $form; } function blogtxt_admin_head() { // Additional CSS styles for the theme options menu ?>

    View site.', 'blogtxt'), get_bloginfo('home') . '/'); ?>

    Thanks for selecting the blog.txt theme by Scott Allan Wallick. Please read the included documentation for more information about the blog.txt and its advanced features. If you find this theme useful, please consider . You must click on Save Options to save any changes. You can also discard your changes and reload the default settings by clicking on Reset.

    ', 'blogtxt'), blogtxt_donate(), get_template_directory_uri() . '/readme.html' ); ?>

    " tabindex="1" size="10" />

    80%.', 'blogtxt'); ?>

    tabindex="2" />
    tabindex="3" />
    tabindex="4" />
    tabindex="5" />
    tabindex="6" />
    tabindex="7" />
    tabindex="8" />
    tabindex="9" />
    tabindex="10" />

    Georgia.', 'blogtxt'), 'web safe'); ?>

    tabindex="11" />
    tabindex="12" />
    tabindex="13" />
    tabindex="14" />
    tabindex="15" />
    tabindex="16" />
    tabindex="17" />
    tabindex="18" />
    tabindex="19" />

    Arial. ', 'blogtxt'), 'web safe'); ?>

    tabindex="20" />
    tabindex="21" />
    tabindex="22" />
    tabindex="23" />
    tabindex="24" />
    tabindex="25" />
    tabindex="26" />
    tabindex="27" />
    tabindex="28" />

    Times. ', 'blogtxt'), 'web safe'); ?>

    tabindex="29" />
    tabindex="30" />
    tabindex="31" />
    tabindex="32" />
    tabindex="33" />
    tabindex="34" />
    tabindex="35" />
    tabindex="36" />
    tabindex="37" />

    Verdana. ', 'blogtxt'), 'web safe'); ?>

    " tabindex="38" size="10" />

    60em.', 'blogtxt'); ?>

    Two-column (right).', 'blogtxt'); ?>

    left.', 'blogtxt'); ?>

    left.', 'blogtxt'); ?>

    documentation for info). Default is displayed.', 'blogtxt'); ?>

    " size="6" />

    16.', 'blogtxt'); ?>

    Save Options. A reset does not affect the actual theme files in any way. If you are uninstalling blog.txt, please reset before removing the theme files to clear your databse.', 'blogtxt'); ?>

    ' . get_the_author() . ''; } else { echo '† ' . get_the_author() . ''; } } elseif ( get_option('blogtxt_authorlink') =="displayed" ) { if ( is_single() || is_page() ) { return '' . get_the_author() . ''; } else { echo '† ' . get_the_author() . ''; } } elseif ( get_option('blogtxt_authorlink') =="hidden" ) { if ( is_single() || is_page() ) { return '' . get_the_author() . ''; } else { echo ''; } }; } if ( get_option('blogtxt_basefontsize') == "" ) { $basefontsize = '80%'; } else { $basefontsize = attribute_escape( stripslashes( get_option('blogtxt_basefontsize') ) ); }; if ( get_option('blogtxt_basefontfamily') == "" ) { $basefontfamily = 'georgia,times,serif'; } else { $basefontfamily = wp_specialchars( stripslashes( get_option('blogtxt_basefontfamily') ) ); }; if ( get_option('blogtxt_headingfontfamily') == "" ) { $headingfontfamily = 'arial,helvetica,sans-serif'; } else { $headingfontfamily = wp_specialchars( stripslashes( get_option('blogtxt_headingfontfamily') ) ); }; if ( get_option('blogtxt_blogtitlefontfamily') == "" ) { $blogtitlefontfamily = '\'times new roman\',times,serif'; } else { $blogtitlefontfamily = wp_specialchars( stripslashes( get_option('blogtxt_blogtitlefontfamily') ) ); }; if ( get_option('blogtxt_miscfontfamily') == "" ) { $miscfontfamily = 'verdana,geneva,sans-serif'; } else { $miscfontfamily = wp_specialchars( stripslashes( get_option('blogtxt_miscfontfamily') ) ); }; if ( get_option('blogtxt_layoutwidth') == "" ) { $layoutwidth = '60em'; } else { $layoutwidth = attribute_escape( stripslashes( get_option('blogtxt_layoutwidth') ) ); }; if ( get_option('blogtxt_layouttype') == "" ) { $layouttype = '2c-r.css'; } else { $layouttype = attribute_escape( stripslashes( get_option('blogtxt_layouttype') ) ); }; if ( get_option('blogtxt_layoutalignment') == "" ) { $layoutalignment = 'body div#wrapper{margin:5em 0 0 7em;}'; } elseif ( get_option('blogtxt_layoutalignment') =="center" ) { $layoutalignment = 'body div#wrapper{margin:5em auto 0 auto;padding:0 1em;}'; } elseif ( get_option('blogtxt_layoutalignment') =="left" ) { $layoutalignment = 'body div#wrapper{margin:5em 0 0 7em;}'; } elseif ( get_option('blogtxt_layoutalignment') =="right" ) { $layoutalignment = 'body div#wrapper{margin:5em 3em 0 auto;}'; }; if ( get_option('blogtxt_posttextalignment') == "" ) { $posttextalignment = 'left'; } else { $posttextalignment = attribute_escape( stripslashes( get_option('blogtxt_posttextalignment') ) ); }; ?>