Review Engine Theme

Discussion

is_category function within the hook_functions.php page

No Picture
CUSTOMER

SmartCompare

posted
Joined: April 18, 2011

Number of posts : 20

is_category function within the hook_functions.php page

Solved

Dear Support,

I need help regarding the is_category function within the hook_functions.php page.

Below are the two functions i need to change.

add_filter(‘posts_where’, ‘filter_where_top’);
function filter_where_top($where)
{
global $wpdb;
$post_meta = $wpdb->postmeta;
if(is_home())
{
$where = ” AND post_type = ‘product’ AND post_status=’publish’ AND $post_meta.meta_key = ‘tgt_rating’ AND $post_meta.meta_value + 0 > 0″;
}
else if(is_tag() || is_category())
{
$where = ” AND post_type = ‘product’ AND post_status=’publish’”;
}
else if(is_search())
{
$key = ”;
if( isset( $_GET['key'] ) ) {
$key = $_GET['key'];
}
$where = ” AND post_type = ‘product’ AND post_status=’publish’ AND post_title LIKE ‘%” . $key . “%’”;
}
else if(is_author())
{
$u = $wpdb->users;
$where = “AND post_type = ‘product’ AND post_status=’publish’”;
}
else if(is_feed())
{
$where = “AND post_type = ‘product’ AND post_status=’publish’”;
}
return $where;
}

add_filter(‘posts_orderby’, ‘filter_order_top’ );
function filter_order_top($order)
{
global $wpdb;
$post_meta = $wpdb->postmeta;
var_dump($post_meta);
if(is_home())
{
$order = “$post_meta.meta_value + 0 DESC”;
}
else if(is_author())
{
$c = $wpdb->comments;
$order = “$c.comment_date DESC”;
}
return $order;
}

When i add is_category to the filter_order_top function i break the code and shows no category. Same occurs when i modify the where function with is_category. Is there anything i need to do inorder to modify this?

Thanks.

Please login to follow this topic !

Like this topic

3 Replies to this Discussion

Please login to your customer account to view this content.