<?php
// WordPress 3.0 Features
// This theme allows users to set a custom background
if (function_exists('add_custom_background')) add_custom_background();
// This theme allows users to use custom menus
if (function_exists('register_nav_menus')) register_nav_menus( array('primary' => __( 'Top Navigation', 'ml' ),) );
// helper functions
if ( function_exists('wp_list_bookmarks') ) //used to check WP 2.1 or not
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' and post_status = 'publish'");
else
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
$numcmnts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcmnts) $numcmnts = number_format($numcmnts);
// ----------------
// For backward Compatiblity to older versions of WordPress
add_filter( 'comments_template', 'legacy_comments' );
function legacy_comments( $file ) {
if ( !function_exists('wp_list_comments') )
$file = TEMPLATEPATH . '/old-comments.php';
return $file;
}
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<li class="sidebox">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
if ( function_exists('unregister_sidebar_widget') )
{
unregister_sidebar_widget( __('Links') );
}
if ( function_exists('register_sidebar_widget') )
{
register_sidebar_widget(__('Links'), 'mistylook_ShowLinks');
}
if ( function_exists('register_sidebar_widget') )
{
register_sidebar_widget(__('About'), 'mistylook_ShowAbout');
}
function mistylook_ShowAbout() {?>
<?php }
function ds_sitewide_tags_get_comments_num($count) {
global $blog_id, $wpdb, $post;
$tags_blog_id = get_site_option( 'tags_blog_id' );
if( !$tags_blog_id || $blog_id != $tags_blog_id ) return $count;
list( $post_blog_id, $post_id ) = explode( '.', $post->guid );
$base = $wpdb->get_blog_prefix( $post_blog_id );
$r = $wpdb->get_col( "SELECT comment_count FROM {$base}posts WHERE ID=$post_id" );
if( is_array( $r ) ) return $r[0] + $count;
return $count;
}
add_filter('get_comments_number', 'ds_sitewide_tags_get_comments_num');
{?>
<li class="sidebox">
<h3><?php _e('About','ml');?></h3>
<p>
<img src="<?php bloginfo('stylesheet_directory');?>/img/profile.jpg" alt="<?php _e('Profile','ml');?>" /><br/>
<strong><?php bloginfo('name');?></strong><br/><?php bloginfo('description');?><br/>
<?php _e('There are','ml');?> <?php global $numposts;echo $numposts; ?> <?php _e('Posts and','ml');?> <?php global $numcmnts;echo $numcmnts;?> <?php _e('Comments so far.','ml');?>
</p>
</li>