All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: ¿How to display highest or most rated list wit thumbnail? Here the answer!  (Read 4109 times)

0 Members and 1 Guest are viewing this topic.

Offline juanpons14

  • Newbie
  • *
  • Posts: 4
    • View Profile
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:

Code: [Select]
<?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:

Code: [Select]
<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>&nbsp;<?php $key="ratings_users"; echo get_post_meta($post->ID$keytrue); ?>&nbsp;veces</span></td>
<td style="width:335; height:30; vertical-align:middle;">&nbsp;</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$keytrue); ?></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:

Code: [Select]
<?php endwhile; ?>
And it is finished without modifying anything.

You can see it in http://www.universoflash.com

SHARE!!....................

Bye

« Last Edit: 29 July 2009, 01:42 by juanpons14 »

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Thanks for sharing the tips with the rest of the users =)

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline juanpons14

  • Newbie
  • *
  • Posts: 4
    • View Profile
Thanks for sharing the tips with the rest of the users =)


Thank for you to share yours plugin. It's fantastic.

Don't worry be happy.

What do you think about this code?

And about mi web page?

Thank for the comment

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Your code is correct and straighforward =)

Your site layout is not bad, but I think you could brighten up the colors a little.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline juanpons14

  • Newbie
  • *
  • Posts: 4
    • View Profile
Your code is correct and straighforward =)

Your site layout is not bad, but I think you could brighten up the colors a little.


Thanks GamerZ for all ;)

Offline fmsllc

  • Newbie
  • *
  • Posts: 3
    • View Profile
THANK YOU JUAN. I was looking for a solution to this problem for quite some time and ..... I can't believe how easy it was with simple addition of some code and a plugin. I literally spent over a week looking for a solution without adding custom fields.

Also a huge thanks to the Mr. Chan for making some great plugins!!!!!!

Offline juanpons14

  • Newbie
  • *
  • Posts: 4
    • View Profile
I also can't believe how easy it was...only it was thinking and look the Wordpress Docs.

Bye and I'm glad for helping people!!

If you need any support only ask here.. =)  :D

Offline fmsllc

  • Newbie
  • *
  • Posts: 3
    • View Profile
I also can't believe how easy it was...only it was thinking and look the Wordpress Docs.

Bye and I'm glad for helping people!!

If you need any support only ask here.. =)  :D


question, I'm trying to display only the post rated more than X amount of times. What do I need to add to the code to make that happen?

An example is what Chan already included, the ability to:

"The value 0 refers to the minimum votes required before the post get shown."

Now using the query post function, can I still achieve that?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
I don't think you can archive that using the query_post function.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline K4iz3n

  • Newbie
  • *
  • Posts: 5
    • View Profile
If I want to post it on a page, do I post everything? Sorry I am new and its kinda confusing for me.

Firstly I edit my single.php to look like this:
Code: [Select]
<?php $aOptions MyTheme::initOptions(false); ?>
<?php
if ( have_posts() ) { the_post(); rewind_posts(); }
<?
php query_posts('r_sortby=highest_rated&r_orderby=DESC&showposts=50&cat=1'?>

<?php while (have_posts()) : the_post(); ?>
if ( in_category($aOptions['sideblog-cat']) ) {
include(TEMPLATEPATH . '/single-blog.php');
} else {
include(TEMPLATEPATH . '/single-video.php');
}
<?php endwhile; ?>
?>

An then on my page, I posted this:
Code: [Select]
<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>&nbsp;<?php $key="ratings_users"; echo get_post_meta($post->ID$keytrue); ?>&nbsp;veces</span></td>
   <td style="width:335; height:30; vertical-align:middle;">&nbsp;</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$keytrue); ?></b></font></td></table>
</div>

Obviously this didnt work. Can someone tell me what I did wrong?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
query_posts suppose to come before have_post() and you can only have 1 query_post in the page.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline K4iz3n

  • Newbie
  • *
  • Posts: 5
    • View Profile
What I wanted to do is have a page displaying say the top 50 Highest Rated posts. Each line will have a small thumbnail, the name of the post and the ratings for the post. Is that possible?

Sorry to hijack this, should I start a new thread?

Offline cadan

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: N/A it is a custom theme
I would like to accomplish placing a thumbnail next to the highest rated, however these instructions are not very clear or complete. What file(s) are we placing these queries into?

How do I get a thumbnail using this code below in my header? BTW, I'm using "Get The Image" plugin if this is possible. They have a string you can use on your index page that works nicely...
Code: [Select]
<?php get_the_image( array( 'image_scan' => true ) ); ?> ...can this be worked into the code below?

Code: [Select]
<?php if (function_exists('get_highest_rated')): ?>
<?php get_highest_rated('post'01); ?>
<?php endif; ?>
« Last Edit: 28 December 2009, 18:30 by cadan »