• Hello,
    I am runnigg a web site with custom post types. I would like to show my visitors my top 5 custom posts depending on their comment counts. I’ve already a code but it show not top commented custom posts, shows last 5. Here is the code. If it’s so difficult, it may be random showing, it’ll be enough. Thank you very much in advance.

    <div class="last">
    	<h3 class="h3"> Recent Posts</h3>
    	<?php
    		$my_query = new WP_Query('post_type=customp&showposts=5');
    		while ($my_query->have_posts()) : $my_query->the_post();
    	?>
    
    	<div class="last">
    	<?php
    		if ( has_post_thumbnail() ) { ?>
    			<img class="thmb" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=80&w=90&amp" alt="<?php the_title(); ?> Recipe"/>
    	<?php } else { ?>
    			<img class="thmb" src="images/none.jpg" alt="" />
    	<?php } ?>
    		<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo short_title('...', 5); ?></a></h3>
    		<p><span class="clock">  Date: <?php the_time('M - j - Y'); ?></span></p>
    		<p><span class="comm"><?php comments_popup_link('0 Comment', '1 Comment', '% Comments'); ?></span></p>
    		<div class="clear"></div>
    	</div>
    	<?php endwhile; ?>
    </div>
  • The topic ‘How to list top 5 custom post types depending on comments?’ is closed to new replies.