Lester Chan's Forums
07 September 2008, 14:00 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Lester Chan’s WordPress Plugins July 2008 Update
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Highest rated from multiple categories  (Read 2344 times)
0 Members and 1 Guest are viewing this topic.
dirs
Newbie
*
Offline Offline

Posts: 5


View Profile
« Topic Start: 21 August 2007, 05:48 »

Hi, today I've needed select an Array of highest rated categories and for this I've make some improvements on the function get_highest_rated_category.

I put this:

Code:
if(is_array($category_id)) {
  $cat_filter = "IN (".join(",", $category_id).")";
  } else {
  $cat_filter = "= $category_id";
}

Before the
Code:
$highest_rated = $wpdb->get_results

and change
Code:
$wpdb->post2cat.category_id = $category_id
to
Code:
$wpdb->post2cat.category_id $cat_filter

Then for call the function for select from multiples categories i use (template):

Code:
<?php get_highest_rated_category(array(29,30,31,32), 'both'100?>

Thanks for read it, i hope this information be helpful.
Logged
GaMerZ
lesterchan.net
Administrator
*****
Offline Offline

Posts: 7,089



View Profile WWW
« Reply #1: 21 August 2007, 05:57 »

THANK YOU for your contribution, I will add it in. Can I have your name and url to add in the source code?
Logged


++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.
dirs
Newbie
*
Offline Offline

Posts: 5


View Profile
« Reply #2: 21 August 2007, 16:09 »

THANK YOU for your contribution, I will add it in. Can I have your name and url to add in the source code?

Yeah Smiley
Dirceu P. Júnior
http://pomoti.com (pt-br)
Logged
GaMerZ
lesterchan.net
Administrator
*****
Offline Offline

Posts: 7,089



View Profile WWW
« Reply #3: 21 August 2007, 18:02 »

noted =)

Thank you
Logged


++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.
Ttech
Official Support
Administrator
*****
Offline Offline

Posts: 4,290



View Profile WWW
« Reply #4: 21 August 2007, 23:50 »

Cool... Smiley
Logged

Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.047 seconds with 23 queries.