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.
Related
I created a custom post type and then I did the following:
In the homepage I have a normal loop which I display the content of that post type like custom fields,thumbnail etc.
Then, via functions.php I created a widget that allows me to show 2 custom post types based on category.
All works fine, but when I view the page the custom field does not show.
I used this code which works in my first loop of the homepage:
<?php echo get_post_meta($post->ID, 'game_offer', true); ?>
For some reason that does not work in the loop that I have in the functions for the widget.
Here the image where you can see that the custom field exists in the backend.
My code in the function looks like this in case needed:
class My_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'my_widget',
'description' => 'Custom Post Type widget',
);
parent::__construct( 'my_widget', 'Cutom Post Type Widget', $widget_ops );
}
public function widget( $args, $instance ) {
echo '<section id="custom_post_type_widget">';
?>
<div class="top_bar">
<h3 class="border-radius">Top Casino Offers</h3>
</div>
<?php
$mypost = array(
'post_type' => 'game_reviews',
'posts_per_page' => 2,
'type' => 'top-casino-offers',
);
$loop = new WP_Query( $mypost );
while ( $loop->have_posts() ) : $loop->the_post();?>
<div class="custom_post_widget_container flex outer">
<div class="left">
<?php
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
if ( has_post_thumbnail() ) {
echo '<div class="game_imag">';
echo the_post_thumbnail();
echo '</div>';
}
?>
</div>
<div class="right">
<div>
<div class="flex">
<div>
<p>
<span class="title"><?php the_title(); ?></span> | <span class="rating">
<?php
$nb_stars = intval( get_post_meta( get_the_ID(), 'game_rating', true ) );
for ( $star_counter = 1; $star_counter <= 5; $star_counter++ ) {
if ( $star_counter <= $nb_stars ) {
echo '<img src="'.get_template_directory_uri().'/images/icon.png"/>';
} else {
echo '<img src="'.get_template_directory_uri().'/images/grey.png"/>';
}
}
?>
</span>
</p>
<ul class="custom-field-list">
<li><?php echo get_post_meta($post->ID, 'game_offer', true); ?></li>
</ul>
<?php echo get_post_meta($post->ID, 'game_offer', true); ?>
</div>
<div class="right">
<ul class="play-reviews flex">
<li>Play Now</li>
<li>Reviews</li>
</ul>
</div>
</div>
<p><?php echo get_the_excerpt(); ?><a class="read-more" href="<?php the_permalink(); ?>">Read More</a></p>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query();
echo '</section>';
}
}
add_action( 'widgets_init', function(){
register_widget( 'My_Widget' );
});
How can I show my custom field?
Use query_posts instead of WP_Query
<?php
class My_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'my_widget',
'description' => 'Custom Post Type widget',
);
parent::__construct( 'my_widget', 'Cutom Post Type Widget', $widget_ops );
}
public function widget( $args, $instance ) {
echo '<section id="custom_post_type_widget">';
?>
<div class="top_bar">
<h3 class="border-radius">Top Casino Offers</h3>
</div>
<?php
global $post;
$game_reviews_args=array(
'post_type' => 'game_reviews',
'post_status' => 'publish',
'showposts' => 2,
'tax_query' => array(
array(
'taxonomy' => 'type', //taxonomy name
'terms' => 'top-casino-offers', //category name slug
'field' => 'slug'
)
),
'orderby' => 'date',
'order' => 'DESC'
);
query_posts($game_reviews_args);
if (have_posts()) :
while (have_posts()) : the_post();
?>
<div class="custom_post_widget_container flex outer">
<div class="left">
<?php
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
if ( has_post_thumbnail() ) {
echo '<div class="game_imag">';
echo the_post_thumbnail();
echo '</div>';
}
?>
</div>
<div class="right">
<div>
<div class="flex">
<div>
<p>
<span class="title"><?php the_title(); ?></span> | <span class="rating">
<?php
$nb_stars = intval( get_post_meta( $post->ID, 'game_rating', true ) );
for ( $star_counter = 1; $star_counter <= 5; $star_counter++ ) {
if ( $star_counter <= $nb_stars ) {
echo '<img src="'.get_template_directory_uri().'/images/icon.png"/>';
} else {
echo '<img src="'.get_template_directory_uri().'/images/grey.png"/>';
}
}
?>
</span>
</p>
<ul class="custom-field-list">
<li><?php echo get_post_meta($post->ID, 'game_offer', true); ?></li>
</ul>
<?php echo get_post_meta($post->ID, 'game_offer', true); ?>
</div>
<div class="right">
<ul class="play-reviews flex">
<li>Play Now</li>
<li>Reviews</li>
</ul>
</div>
</div>
<p><?php echo get_the_excerpt(); ?><a class="read-more" href="<?php the_permalink(); ?>">Read More</a></p>
</div>
</div>
</div>
<?php
endwhile;
endif;
wp_reset_query();
echo '</section>';
}
}
add_action( 'widgets_init', function(){
register_widget( 'My_Widget' );
});
?>
So after all I figured that all I needed was the global $post variable before the WP_Query instance:
global $post;
I have a custom post type "events" and I want to display the events in a table of 3 columns with pagination using code in wordpress.
This is what I did so far but that displays it as a list.
$loop = new WP_Query( array( 'post_type' => 'events' , 'posts_per_page' => 3) );
$count = $loop->post_count;
if ( $loop->have_posts() ) :
?>
<h2 style="position:relative;top:100px" align="center"> News & Events</h2>
<div id = "menu" style="position:relative;top:100px;left:350px">
<ul>
<li class = "aa"><a class="anchor" id="all" href="#">All</a></li>
<li class = "aa"><a class="anchor" id ="videos" href="#">Videos</a></li>
<li class = "aa"><a class="anchor" name = "links" id="links" href="#">Links</a></li>
<li class = "aa"><a class="anchor" id = "our events" name ="our events" href="#">Our Events</a></li>
</ul>
</div>
<br>
<br><br>
<?php
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="pindex" style="position:relative;top:100px;left:-450px">
<?php if ( has_post_thumbnail() ) { ?>
<div class="pimage">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="ptitle">
<h2><?php
echo get_the_title() ?></h2>
<div style="width:20%;position:relative;top:10px;left:550px" ><?php echo the_content();?> </div>
</div>
</div>
<?php
endwhile;
if ( $loop->max_num_pages > 1 ) : ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Previous', 'domain' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Next <span class="meta-nav">→</span>', 'domain' ) ); ?></div>
</div>
<?php endif;
endif;
wp_reset_postdata();
Can someone help me with this?
You use this method for display custom post events and pagination as it is
$args = array(
'post_type' => 'events',
'posts_per_page' => 3
);
$posts_array = get_posts( $args );
// print_r($posts_array);
foreach ( $posts_array as $post ){
echo $post->ID;
}
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++;
}
I am trying to exclude the post from the second loop which are already shown in the first one.
I have a page template created to display newest one Custom Post named "inspirations".
I created a widget to display the other posts from the same post type and used that widget on the page template I created.
Here is the code of the Page Template:
<?php
/**
* Template Name: Inspiratie
*
* A custom page template without sidebar.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*/
get_header(); ?>
<div id="container" class="seprator">
<div id="content" class="inspiratie-area" role="main">
<?php $inspiratiepage_query = new WP_Query('showposts=1&post_type=inspirations'); ?>
<?php while ($inspiratiepage_query->have_posts()) : $inspiratiepage_query->the_post(); ?>
<div class="inspiratie-box" id="inspiratie-<?php the_ID(); ?>">
<h2 class="entry-title orange">
<?php the_title(); ?>
</h2>
<?php the_content() ?>
<div class="clear"></div>
</div>
<?php endwhile; // end of the loop. ?>
</div>
</div>
<?php get_footer(); ?>
below is the code of my widget I created:
class Meer_Inspiratie extends WP_Widget {
function Meer_Inspiratie() {
$widget_ops = array('classname' => 'Meer_Inspiratie', 'description' => 'Display Inspiratie Posts' );
$this->WP_Widget('Meer_Inspiratie', 'Inspiratie Post Widget', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = $instance['title'];
$items = $instance['items'];
if(!empty($title))
{
echo $before_title;
echo $title;
echo $after_title;
}
if(!empty($items))
{ ?>
<?php
$inspiratie_query = new WP_Query( array(
'post_type' => 'inspirations',
'posts_per_page' => $items,
'post__not_in' => array(1),
)
); ?>
<?php while ($inspiratie_query->have_posts()) : $inspiratie_query->the_post(); ?>
<div class="inspiratie_query">
<p class="inspiratie_txt"><?php the_excerpt() ?></p>
<div class="inspiratie_img">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('inspiratie-product-thumb');}?>
</div>
<div class="inspiratie_quote">
<?php
echo '<blockquote class="inspiratie-quote">';
echo get_post_meta( get_the_ID(), 'my_specs_box_quote', true );
echo '</blockquote>';
?>
</div>
<div class="clear"></div>
<a class="more-post" href="<?php the_permalink()?>">Lees meer</a>
</div>
<?php endwhile; // end of the loop. ?>
<?php }
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['items'] = strip_tags($new_instance['items']);
$instance['title'] = $new_instance['title'];
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'items' => '', 'title' => '') );
$items = strip_tags($instance['items']);
$title = $instance['title'];
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('items'); ?>">No. of Items: <input class="widefat" id="<?php echo $this->get_field_id('items'); ?>" name="<?php echo $this->get_field_name('items'); ?>" type="text" value="<?php echo esc_attr($items); ?>" /></label></p>
<?php
}
}
register_widget('Meer_Inspiratie');
/**
* End Inspiratie Post Widget
**/
I am trying to exclude the post I have currently in my content area from the widget..
Thank in advance....
dnt know where your sidebar widget is calling from in your template page but it its call below the first loop of your post where you are pulling 1 post dden have a try something like this
<?php
$not_id=get_the_ID();
$inspiratie_query = new WP_Query( array(
'post_type' => 'inspirations',
'posts_per_page' => $items,
'post__not_in' => array($not_id),
)
); ?>
havent check the code. hope this work for you
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.