Permalink
Browse files

Updated comment display functions.

  • Loading branch information...
1 parent 4bd4b2f commit 74b47757c27129c99c49f153dff16b21dfeba66c @jeremyclark13 committed Nov 30, 2012
Showing with 29 additions and 105 deletions.
  1. +2 −2 comments.php
  2. +24 −67 functions/tech-comments-functions.php
  3. +3 −36 style.css
View
4 comments.php
@@ -23,10 +23,10 @@
?>
<h3 id="comments"><?php comments_number( __( 'No Comments', 'techozoic' ), __( 'One Comment', 'techozoic' ), _n( '% Comment', '% Comments', get_comments_number(), 'techozoic' ) ); ?></h3>
<ol class="commentlist">
- <?php wp_list_comments( 'type=comment&callback=techozoic_comment' ); ?>
+ <?php wp_list_comments( 'callback=techozoic_comment' ); ?>
</ol>
<ol class="trackback">
- <?php wp_list_comments( 'type=pings&callback=techozoic_ping' ); ?>
+ <?php //wp_list_comments( 'type=pings&callback=techozoic_ping' ); ?>
</ol>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
View
91 functions/tech-comments-functions.php
@@ -12,30 +12,6 @@
*
*/
-/**
- * Techozoic comment count
- *
- * Filter that displays correct comment count.
- * http://www.wpbeginner.com/wp-tutorials/display-the-most-accurate-comment-count-in-wordpress/
- *
- *
- * @param string $count filter variable
- * @return string $count correct comment count
- *
- * @access private
- * @since 1.9.3
- */
-add_filter( 'get_comments_number', 'tech_comment_count', 0 );
-
-function tech_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;
- }
-}
/**
* Techozoic additional comment management links
@@ -49,7 +25,6 @@ function tech_comment_count( $count ) {
* @access private
* @since 2.0.1
*/
-
function delete_comment_link( $id, $post_name ) {
if ( current_user_can( 'edit_posts' ) ) {
echo ' | <a href="' . admin_url( "comment.php?action=cdc&amp;c=$id&redirect_to=/" . $post_name . "/" ) . '">' . __( 'Delete', 'techozoic' ) . '</a> ';
@@ -68,83 +43,67 @@ function delete_comment_link( $id, $post_name ) {
*
* @access private
*/
-
function techozoic_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
global $post;
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
- <div class="avatar_cont"><?php echo get_avatar( $comment, '50' ); ?></div>
- <?php printf( __( 'Comment by %s', 'techozoic' ), '<em>' . get_comment_author_link() . '</em>' ); ?>:
+ <?php if ( $comment->comment_type == '' ) { ?>
+ <div class="avatar_cont"><?php echo get_avatar( $comment, '50' ); ?></div>
+ <?php }
+ if ( $comment->comment_type == '' ) {
+ printf( __( 'Comment by %s', 'techozoic' ), '<em>' . get_comment_author_link() . '</em>' );
+ } else {
+ printf( __( 'Ping from %s', 'techozoic' ), '<em>' . get_comment_author_link() . '</em>' );
+ }
+ ?>:
<?php if ( $comment->comment_approved == '0' ) { ?>
<em><?php _e( 'Your comment is awaiting moderation.', 'techozoic' ) ?></em>
<?php } ?>
<br />
<small class="commentmetadata">
- <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date( 'l, F jS Y' ) ?> at <?php comment_time() ?></a>&nbsp;|&nbsp;<?php edit_comment_link( __( 'Edit', 'techozoic' ), '', '' );
+ <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date( 'l, F jS Y' ) ?> at <?php comment_time() ?></a>&nbsp;|&nbsp;<?php
+ edit_comment_link( __( 'Edit', 'techozoic' ), '', '' );
if ( $post->post_type == 'post' ) {
delete_comment_link( $comment->comment_ID, $post->post_name );
}
?>
</small>
-
<?php comment_text(); ?>
<div class="reply">
<?php echo comment_reply_link( array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ); ?>
</div>
</div>
<?php
-}
+ }
// End function techozoic_comment
/**
- * Techozoic ping/trackback callback
- *
- * Callback for displaying ping/trackbacks
- *
- * @param object $comment comment object from callback
- * @param array $args args from callback
- * @param string $depth comment nesting depth from callback.
- *
- * @access private
- */
-
-function techozoic_ping( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- ?>
- <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"><?php printf( __( 'Ping from %s', 'techozoic' ), get_comment_author_link() ); ?>
- </li>
- <?php
-}
-// End function techozoic_ping
-
-/**
* Techozoic gravatar
*
* Template tag for use in comment callback to display avatar with author link
* if link was left.
*
* @access public
*/
-
function techozoic_gravatar() {
- echo '<div class="avatar_cont">';
- global $comment;
- if ( !empty( $comment->comment_author_url ) ) {
- // Did they leave a link
- ?>
+ echo '<div class="avatar_cont">';
+ global $comment;
+ if ( !empty( $comment->comment_author_url ) ) {
+ // Did they leave a link
+ ?>
<a rel="external nofollow" href="<?php comment_author_url(); ?>" title="<?php comment_author(); ?> ">
- <?php echo get_avatar( $comment, '50' ); ?>
+ <?php echo get_avatar( $comment, '50' ); ?>
</a>
- <?php
- } else {
- echo get_avatar( $comment, '50' );
- }
- ?>
- </div>
<?php
+ } else {
+ echo get_avatar( $comment, '50' );
+ }
+ ?>
+ </div>
+ <?php
}
//End techozoic_gravatar
@@ -158,7 +117,6 @@ function techozoic_gravatar() {
* @access private
* @since 2.0.1
*/
-
add_action( 'wp_enqueue_scripts', 'techozoic_enqueue_comment_reply' );
function techozoic_enqueue_comment_reply() {
@@ -178,7 +136,6 @@ function techozoic_enqueue_comment_reply() {
* @access public
* @since 1.8.7
*/
-
function tech_comment_preview( $ID ) {
global $comment;
$tech_comment_num = of_get_option( 'comment_preview_num', '3' );
View
39 style.css
@@ -411,22 +411,6 @@ ul.comment-preview li:hover{
padding-top:4px;
}
-.post_date{
- background-color: #A0B3C2;
- border: 1px solid #CCCCCC;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
- -moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.4);
- -webkit-box-shadow:0 0 3px rgba(0,0,0,0.4);
- clear: left;
- float: left;
- height: 40px;
- margin: 0 7px 0 0;
- width: 40px
-}
-
.postmetadata{
clear:left;
color:#777;
@@ -500,11 +484,7 @@ ul.comment-preview li:hover{
float:right;
font-size: .8em;
}
-.tagcont{
- float:left;
- margin:2% 1%;
- width:30%;
-}
+
.post_info{
padding: 5px 5px 8px 10px;
}
@@ -783,7 +763,7 @@ Comments
font-weight:700;
}
-.commentlist li.comment{
+.commentlist li.comment, .commentlist li.trackback, .commentlist li.pingback{
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
@@ -810,10 +790,6 @@ Comments
z-index: 2;
}
-.commentlist li.pingback{
- display:none;
-}
-
.commentlist p{
font-weight:400;
line-height:1.5em;
@@ -825,7 +801,7 @@ Comments
padding-left:5px;
}
-.commentlist, .trackback{
+.commentlist{
padding:0;
text-align:justify;
position:relative;
@@ -857,15 +833,6 @@ Comments
text-align:center;
}
-.trackback li{
- border-bottom:1px solid #ddd;
- font-size:.9em;
- font-weight:700;
- list-style:none;
- margin:2px 0;
- padding:2px 10px;
-}
-
h3.comments{
margin:40px auto 20px;
padding:0;

0 comments on commit 74b4775

Please sign in to comment.