\n";
}
// Creates a link to the 'home' page when elsewhere; credit to Adam , http://sunburntkamel.archgfx.net/
function barthelme_homelink() {
global $wp_db_version;
$barthelme_frontpage = get_option('show_on_front');
$barthelme_is_front = get_option('page_on_front');
if ( $barthelme_frontpage == 'page' ) {
if ( !is_page($barthelme_is_front) || is_paged() ) { ?>
' . $user_info->first_name . '' . $user_info->last_name . '';
}
// Produces an hCard for post authors
function barthelme_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 barthelme_body_class( $print = true ) {
global $wp_query, $current_user;
$c = array('wordpress');
barthelme_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) )
barthelme_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 = 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 barthelme_post_class( $print = true ) {
global $post, $barthelme_post_alt;
$c = array('hentry', "p$barthelme_post_alt", $post->post_type, $post->post_status);
$c[] = 'author-' . get_the_author_login();
foreach ( (array) get_the_category() as $cat )
$c[] = 'category-' . $cat->category_nicename;
barthelme_date_classes(mysql2date('U', $post->post_date), $c);
if ( ++$barthelme_post_alt % 2 )
$c[] = 'alt';
$c = join(' ', apply_filters('post_class', $c));
return $print ? print($c) : $c;
}
$barthelme_post_alt = 1;
// Produces semantic classes for the each individual comment li; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/
function barthelme_comment_class( $print = true ) {
global $comment, $post, $barthelme_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';
}
barthelme_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-');
if ( ++$barthelme_comment_alt % 2 )
$c[] = 'alt';
$c[] = "c$barthelme_comment_alt";
$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 barthelme_date_classes($t, &$c, $p = '') {
$t = $t + (get_settings('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);
}
// Produces links to categories other than the current one; Originally from the Sandbox, http://www.plaintxt.org/themes/sandbox/
function barthelme_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));
}
// Loads a Barthelme-style Search widget
function widget_barthelme_search($args) {
extract($args);
?>
except the home.', 'barthelme'); ?>
'
', 'title_after'=>'
', 'show_images'=>true));
} else {
global $wpdb;
$cats = $wpdb->get_results("
SELECT DISTINCT link_category, cat_name, show_images,
show_description, show_rating, show_updated, sort_order,
sort_desc, list_limit
FROM `$wpdb->links`
LEFT JOIN `$wpdb->linkcategories` ON (link_category = cat_id)
WHERE link_visible = 'Y'
AND list_limit <> 0
ORDER BY cat_name ASC", ARRAY_A);
if ($cats) {
foreach ($cats as $cat) {
$orderby = $cat['sort_order'];
$orderby = (bool_from_yn($cat['sort_desc'])?'_':'') . $orderby;
echo '
\n";
}
}
}
}
// Loads, checks that Widgets are loaded and working
function barthelme_widgets_init() {
if ( !function_exists('register_sidebars') )
return;
$p = array(
'before_title' => "
View site »', 'barthelme'), get_bloginfo('home') . '/'); ?>
Barthelme theme. You can customize this theme with the options below. 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.', 'barthelme'); ?>
Resetting clears all changes to the above options. After resetting, default options are loaded and this theme will continue to be the active theme. A reset does not affect the actual theme files in any way.', 'barthelme'); ?>
Barthelme theme, version ' . $installedVersion . ', by ScottAllanWallick.', 'barthelme'); ?>
documentation for more information about the Barthelme theme and its advanced features.', 'barthelme'), get_template_directory_uri() . '/readme.html'); ?>