Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // CHANGE EXCEPT TO CONTAIN READ MORE LINK
- function new_excerpt_more($post) {
- return '... <a href="'. get_permalink($post->ID) . '">' . '<span class="continue-reading">Continue Reading...</span>' . '</a>';
- }
- add_filter('excerpt_more', 'new_excerpt_more');
- //ADD THUMBNAIL OPTION TO DASHBOARD
- add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
- set_post_thumbnail_size( 174, 135, true ); // 50 pixels wide by 50 pixels tall, hard crop mode
- //CUSTOM GRAVATAR
- add_filter( 'avatar_defaults', 'newgravatar' );
- function newgravatar ($avatar_defaults) {
- $myavatar = get_bloginfo('template_directory') . '/images/light-grey-wren.png';
- $avatar_defaults[$myavatar] = "Custom Avatar";
- return $avatar_defaults;
- }
- //POPULAR POSTS
- function most_popular_posts($no_posts = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $duration='') {
- global $wpdb;
- $request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
- $request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
- if(!$show_pass_post) $request .= " AND post_password =''";
- if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
- }
- $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
- $posts = $wpdb->get_results($request);
- $output = '';
- if ($posts) {
- foreach ($posts as $post) {
- $post_title = stripslashes($post->post_title);
- $comment_count = $post->comment_count;
- $permalink = get_permalink($post->ID);
- $output .= $before . '<a href="' . $permalink . '">' . $post_title . '</a>' . $after;
- }
- } else {
- $output = '<ul id="recent_comments">
- <li>Posts have not yet been rated</li>
- <ul>';
- }
- echo $output;
- }
- //COMMENT TEMPLATE
- function comment_template($comment, $args, $depth)
- {
- $GLOBALS['comment'] = $comment;
- ?>
- <li class="submitted" id="comment-<?php comment_ID() ?>">
- <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-->
- <div class="content_container">
- <div class="content">
- <div class="arrow"></div>
- <div class="meta">
- <span class="name">
- <?php comment_author_link()?>
- <?php if ($comment->comment_approved == '0') : ?>
- <span class="moderation"><?php _e(' as this is your first comment, it must first be moderated.') ?></span>
- <?php endif; ?></span> <span class="date"><?php comment_date('F j, Y') ?> at <?php comment_time()?></span>
- </div><!--end of meta-->
- <div class="reply_link">
- <?php edit_comment_link(__('Edit'),' ',' | ') ?>
- <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'respond_id' => 'reply',))) ?>
- </div>
- <?php comment_text() ?>
- </div><!--end of content-->
- </div><!--end of content container-->
- <div class="clear"></div>
- <?php
- }
- // TRACKBACKS TEMPLATE
- function pingback_template($comment, $args, $depth)
- {
- $GLOBALS['comment'] = $comment;
- ?>
- <li class="submitted" id="comment-<?php comment_ID() ?>">
- <div class="avatar_container"></div><!--end of avatar container-->
- <div class="content_container">
- <div class="content">
- <div class="meta">
- <span class="name">
- <?php comment_author_link()?>
- <?php if ($comment->comment_approved == '0') : ?>
- <span class="moderation"><?php _e(' as this is your first comment, it must first be moderated.') ?></span>
- <?php endif; ?></span> <span class="date"><?php comment_date('F j, Y') ?> at <?php comment_time()?></span>
- </div><!--end of meta-->
- <?php comment_text() ?>
- </div><!--end of content-->
- </div><!--end of content container-->
- <div class="clear"></div>
- <?php
- }
- // REMOVE TRACKBACKS FROM COMMENT COUNT
- add_filter('get_comments_number', 'comment_count', 0);
- function comment_count( $count ) {
- if ( ! is_admin() ) {
- global $id;
- $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
- return count($comments_by_type['comment']);
- } else {
- return $count;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement