Top

I wrote this plugin to use with another plugin called Post Star Ratings. (developed by O Douter).

Post Star Ratings is a plugin which allows visitors to your site to vote on your posts.

I wanted to then extend the functionality so that I could display highest and lowest rated posts. So I created the Show High Low plugin. My solution is as follows

Step 1 - Download Post Star Ratings from the above link and start using it.

Step 2 - Use the functionality in the Show High Low plugin (download below) as follows.

<?php show_hilo_posts() ?>

with the following parameter options.

  1. handle - set to ‘votes’ (order by votes) or ‘random’ (output random picks)
  2. cat_id - 0 means all categories or specify your own specific category id
  3. limit - how many posts to display
  4. order_by - ‘asc’ for ascending or ‘desc’ for descending, This has no affect if hangle is ‘random’
  5. before_title - default ‘

  6. after_title - default ‘
  7. len - default 30, this is not required parameter so ignore it

Examples of usage

show_hilo_posts('votes',0,10,'asc') - this would display ten posts with lowest rated first show_hilo_posts('votes',0,10,'desc') - this would display ten posts with lowest rated first show_hilo_posts('random',0,10) - this would display ten random posts

I added the additional functionality to show “random” posts (ignore votes). Simply supply the parameter as described above.

Just add the call to your template and you are away. You will need to play around a bit to work it all out.

Download

Show High Low 0.1 is compatible for versions of Wordpress earlier than 2.3.

Show High Low 0.2 is compatible with Wordpress 2.3 onwards (for now).

Other Stuff
Category Icon Images
Random Image Gallery
BlueTV theme

Alternative to the Plugin - Create your own custom pages

You could if you are able to create your own custom pages rather than use the HiLo plugin, an example of such a page is shown below

For wordpress pre 2.3 you could have template like the example below. You will need to alter this to match your theme and you have to understand how the custom templates in Wordpress work. This approach works in Wordpress 2.3 too.

<?php /* Template Name: CQueryAsc */ ?> <?php get_header(); ?> <div class="content"> <div id="primary"> <?php $pageposts = $wpdb->get_results("SELECT j_wposts.*, wpsr.votes FROM $wpdb->j_posts wposts LEFT OUTER JOIN wp_psr_post wpsr ON wpsr.id = wposts.id WHERE wposts.post_status = 'publish' AND wposts.post_type='post' AND votes != 0 ORDER BY wpsr.points/wpsr.votes ASC LIMIT 10"); if ($pageposts): ?> <div id="primarycontent"> <div> <?php foreach ($pageposts as $post): setup_postdata($post); ?> <div id="post-<?php the_ID(); ?>" class="item entry"> <div class="itemhead"> <br /> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title='<?php printf( __('"%s"','k2_domain'), strip_tags(get_the_title())) ?>'><?php the_title(); ?></a></h3> <small class="metavote"> <?php PSR_show_voting_stars(); ?> </small> </div> <div class="itemtext"> <?php link_pages('<p><strong>'.__('Pages:','k2_domain').'</strong> ', '</p>', __('number','k2_domain')); ?> <?php the_content(__('Continue reading','k2_domain') . " '" . the_title('', '', false) . "'"); ?> </div> <small class="metadata"> <?php the_category(', '); ?> </small> </div> <?php endforeach; ?> </div> </div> <?php else : $notfound = '1'; ?> <div class="center"> <h2>Not Found.</h2> </div> <div class="item"> <div class="itemtext"> <p>Nothing here</p> </div> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> </div> <?php get_footer(); ?>

Comment / question - then you can contact me

Bottom