Aprende una manera de colocar los post más comentados con thumbnails sin utilizar ningún plugin, con solamente insertar un simple código podrás lograr mejorar la visualizacion de los articulos.
Deberemos colocar este código en el sidebar:
1
2
3
4
5
6
7
8
9
10
|
<?php $popular = new WP_Query(‘orderby=comment_count&posts_per_page=5’); ?>
<?php while ($popular->have_posts()) : $popular->the_post(); ?>
<?php $justanimage = get_post_meta($post->ID, ‘Image’, true);
if ($justanimage) { ?>
<img src="<?php echo get_post_meta($post->ID, "Image", true); ?>" alt="<?php the_title(); ?>" />
<?php } else { ?>
<img src="http://an-alternative-image.jpg" alt="" />
<?php } ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile; ?>
|
Via WPrecipes