I am trying to return the number of reviews for a given page ID, I have this so far:
<?php
global $wpdb;
$countreviews = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM $wpdb->wpcreviews WHERE page_id = ID"));
echo 'Number Of Reviews ' . $countreviews . '';
?>
Its not working and I assume it’s the end part page_id = ID
How do I change the ending to that it searches the wpcreviews
table for items with the current page ID, which is the same as my post ID?
1 comment