'Left Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name'=>'Right Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
}
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('//i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "/wp-content/themes/js-paper/imgs/postblank.png";
}
return $first_img;
}
//exclude some category
function my_cat_exclude($query) {
if ($query->is_feed) {
$query->set('cat','-990');
}
return $query;
}
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 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 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 js_paper_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">