Adding numbers to comments in wordpress - php

I've seen various sites using the built in wordpress comment system with a custom callback (to generate their own html different than that if the built in comments in wordpress) adding numbers to comments on their site.
Ala - http://mobile.smashingmagazine.com/2013/08/12/creating-high-performance-mobile-websites/
Each comment has a number beside it.
After doing a whole lot of searching I can't find any built in function of wordpress that does this.
I'm using a custom calllback for my comments.
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
<?php if ( 'div' != $args['style'] ) : ?>
<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
<?php endif; ?>
<div class="comment-author vcard">
<div class="rounded">
<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
</div> <!-- end div rounded -->
</div> <!-- end div vcard -->
<div class="comment-meta commentmetadata">
<?php printf(__('<cite class="fn">%s</cite> <span class="says"></span>'), get_comment_author_link()) ?>
<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php
printf( __('%1$s at %2$s'), comment_time('F j, Y g:i a')) ?></a><?php edit_comment_link(__('(Edit)'),' ','' );
?>
</a>
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation">
<?php _e('Your comment is awaiting moderation.') ?>
</em>
<br />
<?php endif; ?>
</div> <!-- end div commentmetadata -->
<div class="commentsholder">
<?php comment_text() ?>
</div> <!-- end div commentsholder -->
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div> <!-- end div reply -->
<?php echo '<div style="clear:both"></div>' ?>
<?php if ( 'div' != $args['style'] ) : ?>
</div> <!-- end div commentid -->
<?php endif; ?>
<?php
}
Can anyone give me any idea how to number each comment?

Look at the twentytwelve theme. It uses an ordered list.
<ol class="commentlist">
<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
</ol><!-- .commentlist -->
In the functions.php twentytwelve_comment function the comments are wrapped in a <li></li>.
If your comments are on multiple pages or you want to style the numbers you could use a plugin like http://wordpress.org/plugins/gregs-threaded-comment-numbering/. Read here how to use it.

I was exploring Alexander Kuzmin idea and I think that's how Smashing Magazine is numbering their comments.
It's done in a linear fashion without caring if the comment is threaded or not.
I tested in TwentyEleven, and manipulated the callback for wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );.
In functions.php:
$countcomm = 1;
function twentyeleven_comment( $comment, $args, $depth )
{
global $countcomm;
// PRINT THE COMMENTS AND USE $countcomm TO ECHO THE NEW "COMMENT ID"
// TAKING CARE OF THE COMMENT PERMALINK:
// CHANGE ALL INSTANCES OF comment_ID() AND $comment->comment_ID
// TO $countcomm
$countcomm++;
}

Related

Wrapping a div around the results of a word press loop but excluding the first 2

I have a loop for a custom post type. I'm bringing back a block of title, image and content for each post. I want to apply slick slider to the results to create a slick carousel, but I don;t want to include the first two results of the loop - so I'd need to create a parent div to the results but only start that div after the first two results.
I've trialed ways of querying the results on a loop count to apply a class to only the first two results, but this doesn't really achieve what I'm after.
<div class="wrapper_for_news_items">
<?php
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'news',
'order' => 'DESC'
));
if( $posts ): ?>
<?php $post = $posts[0]; $c=0; ?>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?>
<div class="treatment_block news_block <?php $c++; if($c == 1) { echo ' featured'; } elseif($c == 2) { echo ' featured'; } ?>">
<h2 class="block_title above"> <?php the_title( '' ); ?></h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below"> <?php the_title( '' ); ?></h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div> <!-- treatment news block wrapper -->
You could just create 2 loops.
Use the first for the featured output and the second for the carousel.
<div class="wrapper_for_news_items">
<?php
$args_with_two_posts = array(
'posts_per_page' => 2,
'post_type' => 'news',
'order' => 'DESC'
);
$query_with_two_posts = new WP_Query( $args_with_two_posts );
if( $query_with_two_posts->have_posts ) :
while ( $query_with_two_posts->have_posts ) : $query_with_two_posts->the_posts; ?>
<div class="treatment_block news_block featured">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of 2 post initial news loop -->
</div>
<!-- treatment news block wrapper -->
<?php
// Start your second loop containing the slickslider content
?>
<div class="wrapper_for_news_carousel_items">
<?php
$args_with_all_posts = array(
'posts_per_page' => -1,
'offset' => 2 // Offset the 2 initial posts
'post_type' => 'news',
'order' => 'DESC'
);
$query_with_two_posts = new WP_Query( $args_with_all_posts );
if( $args_with_all_posts->have_posts ) :
while ( $args_with_all_posts->have_posts ) : $args_with_all_posts->the_posts; ?>
<div class="treatment_block news_block">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div>
<!-- treatment news carousel items -->
Or you could count the posts in the loop and asign a wrapper before the third post and after the last post to create the carousel.
<div class="wrapper_for_news_items">
<?php
$args_with_two_posts = array(
'posts_per_page' => 2,
'post_type' => 'news',
'order' => 'DESC'
);
$query = new WP_Query( $args_with_two_posts );
$counter = 1; // Set the counter
if( $query->have_posts ) :
while ( $query->have_posts ) : $query->the_posts;
if ( $count == 3 ) { echo '<div class="slick-slider">'; };
?>
<div class="treatment_block news_block">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php
$counter++; // Add +1 every loop
if (($query->current_post +1) == ($query->post_count)) {
echo '</div>'; // This is the last post
}
endwhile;
?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div>
<!-- treatment news block wrapper -->

Sort Tags by date

I am using WordPress theme. Here is the code I am using there to show the tags in Blog page:
<div class="custom-category">
<?php
$post_tags_show_text = __('Tags', 'directory');
$categories_list = get_the_term_list ( $cs_post_id, 'directory-tag', '<li>', '</li><li>', '</li>' );
if ( isset($categories_list) ){ ?>
<div class="cs-tags"> <!-- cs Tages Start -->
<h5><?php echo esc_attr($post_tags_show_text);?></h5>
<ul> <?php printf( __( '%1$s', 'directory'),$categories_list ); ?></ul>
</div>
<?php
} ?>
</div>
But it is automatically sorts itself alphabetically. Anyway to adjust that so that it will sort by date published/modified?
Thank you in advance.
Try this code:
<div class="custom-category">
<?php
$post_tags_show_text = __('Tags', 'directory');
$terms = wp_get_post_terms ( $cs_post_id, 'directory-tag', array('orderby' => 'date') );
if ( isset($terms) ){ ?>
<div class="cs-tags"> <!-- cs Tages Start -->
<h5><?php echo esc_attr($post_tags_show_text);?></h5>
<ul>
<?php
foreach($terms as $term) {
echo "<li><a href='".get_term_link($term)."' title='".$term->name."'>".$term->name."</a></li>";
}
?>
</ul>
</div>
<?php
} ?>
</div>
https://wordpress.org/support/topic/query-sort-order-with-custom-post-types-and-based-on-custom-field
You need to define it somewhere. It will look something like this
'orderby' => 'meta_value',
'order' => 'ASC');
See the link above

Wordpress query exclude post format form last posts widget

I'm currently developing a Wordpress theme for a project and im looking for a way to exclude posts format from my widget and just keep the standard post format to show in the widget and i dont know where i have to put the code to exclude the post formats
and this the code of my tabs widget
<?php
add_action( 'widgets_init', 'widget_tabs_box' );
function widget_tabs_box(){
register_widget( 'widget_tabs' );
}
class widget_tabs extends WP_Widget {
function widget_tabs() {
$widget_ops = array( 'description' => 'Most Popular, Recent, Comments, Tags' );
$this->WP_Widget( 'widget_tabs',theme_name .'- Tabbed ', $widget_ops );
}
function widget( $args, $instance ) {
<if( empty($instance['posts_number']) || $instance['posts_number'] == ' ' || !is_numeric($instance['posts_number'])) $posts_number = 5;
else $posts_number = $instance['posts_number'];
?>
<div class="widget" id="tabbed-widget">
<div class="widget-container">
<div class="widget-top">
<ul class="tabs posts-taps">
<li class="tabs"><?php _e( 'Popular' , 'aya' ) ?></li>
<li class="tabs"><?php _e( 'Recent' , 'aya' ) ?></li>
<li class="tabs"><?php _e( 'Comments' , 'aya' ) ?></li>
<li class="tabs" style="margin-left:0"><?php _e( 'Tags' , 'aya' ) ?></li>
</ul>
</div>
<div id="main-warp">
<div id="tab1" class="tabs-wrap">
<ul>
<!--latest news-->
<?php aya_popular_posts( $posts_number ) ?>
</ul>
</div>
<div id="tab2" class="tabs-wrap">
<ul>
<?php aya_last_posts( $posts_number )?>
</ul>
</div>
<div id="tab3" class="tabs-wrap">
<ul>
<?php last_comments( $posts_number );?>
</ul>
</div>
<div id="tab4" class="tabs-wrap tagcloud">
<?php wp_tag_cloud( $args = array('largest' => 8,'number' => 25,'orderby'=> 'count', 'order' => 'DESC' )); ?>
</div>
</div>
</div>
</div><!-- .widget /-->
<?php
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['posts_number'] = strip_tags( $new_instance['posts_number'] );
return $instance;
}
function form( $instance ) {
$defaults = array( 'posts_number' => 5 );
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo $this->get_field_id( 'posts_number' ); ?>">Number of items to show : </label>
<input id="<?php echo $this->get_field_id( 'posts_number' ); ?>" name="<?php echo $this->get_field_name( 'posts_number' ); ?>" value="<?php echo $instance['posts_number']; ?>" size="3" type="text" />
</p>
<?php
}
}
?>
and this is the code of the last posts function
function aya_last_posts($numberOfPosts = 5 , $thumb = true){
global $post;
$orig_post = $post;
$lastPosts = get_posts('numberposts='.$numberOfPosts);
foreach($lastPosts as $post): setup_postdata($post);
?>
<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && $thumb ) : ?>
<div class="hole-post">
<div class="post-thumbnail">
<?php aya_thumb('aya-medium'); ?><span class="overlay-icon"></span>
</div><!-- post-thumbnail /-->
<?php endif; ?>
<span class="ss-view">
<?php echo getPostViews(get_the_ID());?>
</span>
<div class="tabtitle"><h3><?php echo the_title(); ?></h3></div>
</li></div><?php endforeach; $post = $orig_post; }
If the last posts section is giving you troubles because of the image thumbnail, the fastest way would be to remove the image from the block. it seems the function accepts a second parameter so, instead of
<?php aya_last_posts( $posts_number )?>
try with
<?php aya_last_posts( $posts_number,false )?>
and see if it works.
As a sidenote: I see a closing </li> element inside the function. I'm pretty sure that there was an opening tag accidentally removed.
Edit: I saw your clarification. Look at the bennining of aya_last_posts, it says
$lastPosts = get_posts('numberposts='.$numberOfPosts);
get_posts accepts parameters such as how many posts to retrieve, and of which type.
Just replace it with
$lastPosts = get_posts(array('numberposts'=>$numberOfPosts,'post_type' =>'post' ));
See the link to find out what else you can customize on get_posts. Perhaps you could pull only posts with a given tag or from a given category.

Not able to pull in featured image

I'm using a wordpress theme as a base to provide horizontal parallax scrolling. I have everything working wonderfully, but when I try to pull the featured image into the page (see CONTENT), nothing will pull up. I can get a static image to show up, but not with any amount of tags or even custom fields. Here is the code for the page:
<?php
/**
* The main file.
*/
get_header(); ?>
<?php require( dirname( __FILE__ ) . "/inc/theme-options-vars.php" ); ?>
<!-- ==================== PARALLAX FUNCTIONS ==================== -->
<?php for( $i=1; $i<=($numposts); $i++ )
{
echo '<div class="hw" id="page-'.$i.'">';
} ?>
<!-- ==================== PARALLAX FUNCTIONS ==================== -->
<?php if($convax_bg1!==''){
echo'
<div class="elem-1">
<div class="elem-1-bg"></div>
</div>';
}
if($convax_bg2!==''){
echo'
<div class="elem-2">
<div class="elem-2-bg"></div>
</div>';
}
?>
<div class="hw" id="content-inner">
<?php
$pages = get_pages( 'sort_order=asc&sort_column=menu_order&depth=1' );
foreach ( $pages as $pag ) {
setup_postdata( $pag );
$new_title = str_replace( " ", "", strtolower( $pag->post_title ) );
$tempname = get_post_meta( $pag->ID, '_wp_page_template', true );
$filename = preg_replace('"\.php$"', '', $tempname);
echo '<div class="page '.$new_title;
echo '" id="' . $new_title . '"><div class="page-info">';
if ( $new_title !== 'home' ) {
echo '<h1>';
echo $pag->post_title;
$pag->post_title;
echo '</h1>';
}
?>
<!-- If Portfolio Page -->
<?php if($filename == 'page-portfolio'):?>
<?php query_posts( array( 'post_type' => 'portfolio_item', 'orderby' => 'date', 'order' => 'ASC' ) ); ?>
<?php if(have_posts()): ?>
<div class="scrollbar1">
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div>
</div></div></div>
<div class="viewport">
<div class="overview">
<div class="rec-proj">
<ul>
<?php while ( have_posts() ) : the_post(); ?>
<li>
<a href="#port-<?php echo $post->ID ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'convaxsolutions' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" class="various">
<?php
if(has_post_thumbnail()) {
the_post_thumbnail('thumbnail');
} else {
echo '<img src="'.get_bloginfo("template_url").'/images/default-featured-image.png" class="portfolio-thumb" width="60" height="60"/>';
}
?>
</a>
<?php edit_post_link('Edit'); ?>
</li>
<?php endwhile; ?>
</ul>
</div><!-- / rec proj -->
</div><!-- / .overview -->
</div><!-- / .viewport -->
</div><!-- / .Scrollbar1 -->
<?php else: ?>
<h1 class="alert"></h1>
<?php endif; ?>
<?php else: ?>
<div class="scrollbar1">
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div> </div></div></div>
<div class="viewport">
<!-- ==================== CONTENT ==================== -->
<div class="overview">
<?php the_content(); ?>
<?php the_post_thumbnail('full'); ?>
</div>
<!-- ==================== CONTENT ==================== -->
</div><!-- / .viewport -->
</div><!-- / .Scrollbar1 -->
<?php endif; ?>
<!-- End If Portfolio-->
<?php echo '</div></div>';
}
?>
<!-- End foreach -->
</div>
<!-- / #content-inner -->
<?php for( $i=1; $i<=($numposts); $i++ )
{
echo '</div>';
} ?>
<?php get_footer(); ?>
Thanks!
Please see the documentation! Get the image with:
get_the_post_thumbnail($pag->ID, 'full');
Documentation for the_post_thumbnail($size, $attr);
This tag must be used within The Loop. Use get_the_post_thumbnail($id,
$size, $attr ) instead to get the featured image for any post.
http://codex.wordpress.org/Function_Reference/the_post_thumbnail

php array not working

This is my first foray into customizing the WP comment form, and it's giving me a bit of trouble.
Ideally, I'd like to have a comment form with 3 fields: Name, Location, and Comment.
To facilitate that, I'm using arrays:
<?php comment_form(array(
'title_reply'=> 'Please feel free to share your home owning hopes and dreams.',
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
'label_submit' => 'Share',
));
?>
In the comment list, I want the comment to display and just below that have "Name | Location"
<div class="comment-content"><?php comment_text(); ?><?php comment_author(); ?> | <?php echo $comment_author_url ?> </div>
As you can see on the live site, it isn't quite coming out that way. Any ideas why that may be? Tips and insight are appreciated.
functions.php
<?php
if ( ! function_exists( 'twentyeleven_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own twentyeleven_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* #since Twenty Eleven 1.0
*/
function twentyeleven_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?></p>
<?php
break;
default :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">
<div class="comment-content"><?php comment_text(); ?><?php comment_author(); ?> | <?php echo $comment_author_url ?> </div>
</article><!-- #comment-## -->
<?php
break;
endswitch;
}
endif; // ends check for twentyeleven_comment()
// Custom callback to list comments in the your-theme style
function custom_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
<div class="comment-author vcard"><?php commenter_link() ?></div>
<div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> Permalink', 'your-theme'),
get_comment_date(),
get_comment_time(),
'#comment-' . get_comment_ID() );
edit_comment_link(__('Edit', 'your-theme'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
<?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'your-theme') ?>
<div class="comment-content">
<?php comment_text() ?>
</div>
<?php // echo the comment reply link
if($args['type'] == 'all' || get_comment_type() == 'comment') :
comment_reply_link(array_merge($args, array(
'reply_text' => __('Reply','your-theme'),
'login_text' => __('Log in to reply.','your-theme'),
'depth' => $depth,
'before' => '<div class="comment-reply-link">',
'after' => '</div>'
)));
endif;
?>
<?php } // end custom_comments
// Custom callback to list pings
function custom_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
<div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'your-theme'),
get_comment_author_link(),
get_comment_date(),
get_comment_time() );
?></div>
<?php if ($comment->comment_approved == '0') _e('\t\t\t\t\t<span class="unapproved">Your trackback is awaiting moderation.</span>\n', 'your-theme') ?>
<div class="comment-content">
<?php comment_text() ?>
</div>
<?php } // end custom_pings
// Produces an avatar image with the hCard-compliant photo class
function commenter_link() {
$commenter = get_comment_author_link();
if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
$commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter );
} else {
$commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );
}
$avatar_email = get_comment_author_email();
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 80 ) );
echo $avatar . ' <span class="fn n">' . $commenter . '</span>';
} // end commenter_link
if (!function_exists('iweb_reverse_comments')) {
function iweb_reverse_comments($comments) {
return array_reverse($comments);
}
}
add_filter ('comments_array', 'iweb_reverse_comments');
// custom comment field
function my_fields($fields) {
$fields['Location'] = '';
return $fields;
}
add_filter('comment_form_default_fields','my_fields');
?>
share.php
<?php
/*
Template Name: Share
*/
?>
<?php get_header(); ?>
<div class="content-left">
<?php comments_template(); ?>
</div><!-- end content-left -->
<div class="content-right">
<?php wp_list_comments( array( 'callback' => 'twentyeleven_comment' )); ?></ul>
</div><!-- end content-right -->
<?php get_footer(); ?>
i don't think it's twentyeleven_comment that you have to edit.
try an echo in the twentyeleven_comment to see if it's the right function.
echo "twentyeleven_comment ";
exit;
i think twentyeleven_comment show all comments of a post in the post view not the post list.

Categories