Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: Fuutski on Oct 23rd, 2011  |  syntax: None  |  size: 2.74 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. // WordPress 3.0 Features
  3. // This theme allows users to set a custom background
  4. if (function_exists('add_custom_background')) add_custom_background();
  5.  
  6. // This theme allows users to use custom menus
  7.         if (function_exists('register_nav_menus')) register_nav_menus( array('primary' => __( 'Top Navigation', 'ml' ),) );
  8.  
  9. // helper functions
  10.   if ( function_exists('wp_list_bookmarks') ) //used to check WP 2.1 or not
  11.     $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' and post_status = 'publish'");
  12.         else
  13.     $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
  14.   if (0 < $numposts) $numposts = number_format($numposts);
  15.         $numcmnts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
  16.                 if (0 < $numcmnts) $numcmnts = number_format($numcmnts);
  17. // ----------------
  18. // For backward Compatiblity to older versions of WordPress
  19. add_filter( 'comments_template', 'legacy_comments' );
  20. function legacy_comments( $file ) {
  21.         if ( !function_exists('wp_list_comments') )
  22.                 $file = TEMPLATEPATH . '/old-comments.php';
  23.         return $file;
  24. }
  25.     if ( function_exists('register_sidebar') )
  26.     register_sidebar(array(
  27.     'before_widget' => '<li class="sidebox">',
  28.                 'after_widget' => '</li>',
  29.                 'before_title' => '<h3>',
  30.                 'after_title' => '</h3>',
  31.         ));
  32. if ( function_exists('unregister_sidebar_widget') )
  33.         {
  34.                 unregister_sidebar_widget( __('Links') );
  35.         }
  36.         if ( function_exists('register_sidebar_widget') )
  37.         {
  38.                 register_sidebar_widget(__('Links'), 'mistylook_ShowLinks');
  39.         }
  40.         if ( function_exists('register_sidebar_widget') )
  41.         {
  42.                 register_sidebar_widget(__('About'), 'mistylook_ShowAbout');
  43.         }
  44. function mistylook_ShowAbout() {?>
  45. <?php }
  46.  
  47. function ds_sitewide_tags_get_comments_num($count) {
  48.   global $blog_id, $wpdb, $post;
  49.         $tags_blog_id = get_site_option( 'tags_blog_id' );
  50.         if( !$tags_blog_id || $blog_id != $tags_blog_id ) return $count;
  51.         list( $post_blog_id, $post_id ) = explode( '.', $post->guid );
  52.         $base = $wpdb->get_blog_prefix( $post_blog_id );
  53.         $r = $wpdb->get_col( "SELECT comment_count FROM {$base}posts WHERE ID=$post_id" );
  54.         if( is_array( $r ) ) return $r[0] + $count;
  55.   return $count;
  56. }
  57. add_filter('get_comments_number', 'ds_sitewide_tags_get_comments_num');
  58. {?>
  59. <li class="sidebox">
  60.         <h3><?php _e('About','ml');?></h3>
  61.         <p>
  62.         <img src="<?php bloginfo('stylesheet_directory');?>/img/profile.jpg" alt="<?php _e('Profile','ml');?>" /><br/>
  63.         <strong><?php bloginfo('name');?></strong><br/><?php bloginfo('description');?><br/>
  64.         <?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');?>
  65.         </p>
  66. </li>
  67.  
clone this paste RAW Paste Data