Hi,
I am trying to make a box for the most popular post (it needs to have thumbnail) and this code works ok when when is display on the home page, but in other pages it displays the whole content of the five post I try using the php function substr() but it did not work. I know there are plugins but I need to display a thumb nail, that is the reason I am creating my own code.
Here is the code:
PHP Code:
<?php $popular = new WP_Query("showposts=5&orderby=comment_count&order=DESC");
while($popular->have_posts()) : $popular->the_post();?>
<?php if( get_post_meta($post->ID, "thumb", true) ): ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=<?php echo get_theme_mod('featured_top_left_thumb_height'); ?>&w=<?php echo get_theme_mod('featured_top_left_thumb_width'); ?>&zc=1" alt="<?php the_title(); ?>" /></a>
<?php else: ?>
<?php endif; ?>
<strong><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></strong>
<?
the_content_limit(80, "");
?>
<hr/>
<?php endwhile; ?>