Thread Starter
phimix
(@phimix)
Great, thanks!
It turned out I needed a slightly different function, but with the help of the code above I was able to throw something together and put it in category.php
function is_in_category($postID, $categoryID) {
global $wpdb;
$sql = “SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE post_id = $postID AND category_id = $categoryID”;
$result = $wpdb->get_var($sql);
if($result > 0)
{
return 1;
}
else
{
return 0;
}
}