Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2010
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.53 KB | None | 0 0
  1. <?php
  2. // CHANGE EXCEPT TO CONTAIN READ MORE LINK
  3. function new_excerpt_more($post) {
  4.     return '... <a href="'. get_permalink($post->ID) . '">' . '<span class="continue-reading">Continue Reading...</span>' . '</a>';
  5. }
  6. add_filter('excerpt_more', 'new_excerpt_more');
  7.  
  8. //ADD THUMBNAIL OPTION TO DASHBOARD
  9.     add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
  10.     set_post_thumbnail_size( 174, 135, true ); // 50 pixels wide by 50 pixels tall, hard crop mode
  11.  
  12. //CUSTOM GRAVATAR
  13.     add_filter( 'avatar_defaults', 'newgravatar' );  
  14. function newgravatar ($avatar_defaults) {
  15.      $myavatar = get_bloginfo('template_directory') . '/images/light-grey-wren.png';
  16.      $avatar_defaults[$myavatar] = "Custom Avatar";
  17.      return $avatar_defaults;
  18. }
  19.  
  20. //POPULAR POSTS
  21.     function most_popular_posts($no_posts = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $duration='') {
  22.     global $wpdb;
  23.     $request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
  24.     $request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
  25.     if(!$show_pass_post) $request .= " AND post_password =''";
  26.     if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
  27.     }
  28.     $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
  29.     $posts = $wpdb->get_results($request);
  30.     $output = '';
  31.     if ($posts) {
  32.     foreach ($posts as $post) {
  33.     $post_title = stripslashes($post->post_title);
  34.     $comment_count = $post->comment_count;
  35.     $permalink = get_permalink($post->ID);
  36.     $output .= $before . '<a href="' . $permalink . '">' . $post_title . '</a>' . $after;
  37.     }
  38.     } else {
  39.     $output = '<ul id="recent_comments">
  40.           <li>Posts have not yet been rated</li>
  41.           <ul>';
  42.     }
  43.     echo $output;
  44.     }
  45.  
  46. //COMMENT TEMPLATE
  47.     function comment_template($comment, $args, $depth)
  48.     {
  49.         $GLOBALS['comment'] = $comment;
  50. ?>
  51.         <li class="submitted" id="comment-<?php comment_ID() ?>">
  52.         <div class="avatar_container"><?php echo get_avatar($comment,$size='45',$default='http://www.fuzeo.com/cms/wp-content/themes/fuzeo/images/comment_img.png' ); ?></div><!--end of avatar container-->
  53.         <div class="content_container">
  54.             <div class="content">
  55.                 <div class="arrow"></div>
  56.                 <div class="meta">
  57.                     <span class="name">
  58.                     <?php comment_author_link()?>
  59.                     <?php if ($comment->comment_approved == '0') : ?>
  60.                         <span class="moderation"><?php _e(' as this is your first comment, it must first be moderated.') ?></span>
  61.                     <?php endif; ?></span> <span class="date"><?php comment_date('F j, Y') ?> at <?php comment_time()?></span>
  62.                 </div><!--end of meta-->
  63.                 <div class="reply_link">
  64.                     <?php edit_comment_link(__('Edit'),'  ',' | ') ?>
  65.                     <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'respond_id' => 'reply',))) ?>
  66.                 </div>
  67.                 <?php comment_text() ?>
  68.             </div><!--end of content-->
  69.         </div><!--end of content container-->
  70.         <div class="clear"></div>
  71.        
  72.         <?php
  73.     }
  74.  
  75. // TRACKBACKS TEMPLATE
  76.     function pingback_template($comment, $args, $depth)
  77.     {
  78.         $GLOBALS['comment'] = $comment;
  79. ?>
  80.         <li class="submitted" id="comment-<?php comment_ID() ?>">
  81.         <div class="avatar_container"></div><!--end of avatar container-->
  82.         <div class="content_container">
  83.             <div class="content">
  84.                 <div class="meta">
  85.                     <span class="name">
  86.                     <?php comment_author_link()?>
  87.                     <?php if ($comment->comment_approved == '0') : ?>
  88.                         <span class="moderation"><?php _e(' as this is your first comment, it must first be moderated.') ?></span>
  89.                     <?php endif; ?></span> <span class="date"><?php comment_date('F j, Y') ?> at <?php comment_time()?></span>
  90.                 </div><!--end of meta-->
  91.                 <?php comment_text() ?>
  92.             </div><!--end of content-->
  93.         </div><!--end of content container-->
  94.         <div class="clear"></div>
  95.         <?php
  96.     }
  97.  
  98. // REMOVE TRACKBACKS FROM COMMENT COUNT
  99. add_filter('get_comments_number', 'comment_count', 0);
  100. function comment_count( $count ) {
  101.         if ( ! is_admin() ) {
  102.                 global $id;
  103.                 $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
  104.                 return count($comments_by_type['comment']);
  105.         } else {
  106.                 return $count;
  107.         }
  108. }
  109. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement