Hi,
I found some code in a previous post that could be used to order listings by package ID. By default I would like it ordered by Featured, Basic, and Free for each custom post type. I tried the following code, changing only the id numbers, but I can’t get it to work. Am I missing something else?
add_filter('geodir_posts_order_by_sort', 'geodir_posts_order_by_sort_my_change',10,3);
function geodir_posts_order_by_sort_my_change($orderby, $sort_by, $table){
if($orderby==' '){
//$orderby = " $table.package_id asc, ";// simply order by package id lowest to greatest
$orderby = " FIELD($table.package_id,1,5,4,3), "; // order by specific package id's
}
return $orderby;
}
Here are the package levels I have:
1 Free gd_place
2 Free gd_services
3 Free gd_sitesandresources
4 Free gd_books
5 Basic gd_place
6 Basic gd_services
7 Basic gd_sitesandresources
9 Featured gd_place
10 Featured gd_services
11 Featured gd_sitesandresources
12 Free gd_event
13 Basic gd_event
14 Featured gd_event
Thanks for your help, as always!