Hello my name is Joh and i'm spanish (sorry for my bad english) after a long time reading and reading this foorum i arrive to the answer to put thumbnails in the highest or most rated list. Is very simple.
What do you need?- WP ostratings plugin
- An automatic and very simple wordpress thumbnail plugin. I use
Simple Grabber works fine in 2.8 wordpress version.
Ok now is time to go to the practise part. The code consist in a jquery list post of wordpress with a loop.
How to use?Well, here you can't use Postrating templates tags but this plugin WP Postratings auto generate custom values in the post to display the number users that have ben rated, and de average.
Is simple, first you have to put this for start the jquery list:
<?php query_posts('r_sortby=highest_rated&r_orderby=DESC&showposts=5&cat=47') ?>
<?php while (have_posts()) : the_post(); ?>
- r_sortby --> Could be highest_rated or most_rated.
- r_orderby --> Could be DESC or ASC.
- showposts --> It depends about how much post do you want to display i want for example five and i put 5.
- cat --> The ID of te category tha you want to display the list of post.
*
You can find more function for the jquery list in wordpress Docs. (like a paginated jquery list)Okk once this is done we have to put after aour template, i'm speaking about our loop. For an example my loop is:
<div class="top_top2" style="padding-left:10px;">
<table style="width:500; height:32; vertical-align:middle; position:absolute;" align="left">
<td style="width:32; height:32; float:left; vertical-align:middle; margin-right:2px;"><div class="thumbnail"><?php images('1', '29', '32', 'aligncenter', true); ?></div></td>
<td style="width:468; height:32; float:left; vertical-align:middle; margin-left:5px;">
<b><font style="margin-top:35px; margin-left:0px;" color="white" size="2" align="left"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></font></b>
</td></table>
<table style="width:450; height:30; vertical-align:middle; margin-top:38px; margin-left:63px; position:absolute;" align="right">
<td style="width:80; height:30; vertical-align:middle; text-align:right; padding-right:217px;"><span style="color:white;"><b>Votado:</b> <?php $key="ratings_users"; echo get_post_meta($post->ID, $key, true); ?> veces</span></td>
<td style="width:335; height:30; vertical-align:middle;"> </td>
<td style="width:35; height:30; vertical-align:middle; padding-left:5px; text-align:center;"><b><font style="color:white; size:14; font-family:sans-serif; font-weight:600;" ><?php $key="ratings_average"; echo get_post_meta($post->ID, $key, true); ?></b></font></td></table>
</div>You can use style css ecause is a simple html code.
As I said before WP Postratign use custom fields and if you read carefully the code before you can see a lot of php functions but there are three that we don't known:
- <?php $key="ratings_users"; echo get_post_meta($post->ID, $key, true); ?> --> This is a function to display the number of user that have voted.
- <?php $key="ratings_average"; echo get_post_meta($post->ID, $key, true); ?> --> This is other function that display de rating average of the post.
- <?php images('1', '29', '32', 'aligncenter', true); ?> --> If you use the Simple Grabber plugin, this is for display a thumbnail. 1 is the number of image, the image number one of the post. 29 i the width. 32 is the height and aligcenter is align center. true is to link the image to the post.
- You can also use the <?php $key="ratings_score"; echo get_post_meta($post->ID, $key, true); ?>
Ok now we have the joquery with the loop is it easy really? then at the end of the loop we have to put:
<?php endwhile; ?>And it is finished without modifying anything.
You can see it in
http://www.universoflash.comSHARE!!....................
Bye