I’m using a WordPress plugin called “Cartpauj PM” for private messages, and I want to show in the main page of my website the number of new messages.
The plugin has a file pm-class.php, where it has a class cartpaujPM, and inside there is a function that gets the new messages that goes like this:
function getNewMsgs()
{
global $wpdb, $user_ID;
$get_pms = $wpdb->get_results($wpdb->prepare("SELECT id FROM $this->tableMsgs WHERE (to_user='$user_ID' AND parent_id=0 AND to_del<>1 AND message_read=0 AND last_sender<>'$user_ID') OR (from_user='$user_ID' AND parent_id=0 AND from_del<>1 AND message_read=0 AND last_sender<>'$user_ID')"));
return $wpdb->num_rows;
}
How could I call this function in my theme template files? In the plugin files it calls like $example_variable=this->getNewMsgs(); doing a echo $example_variable after.
1 Answer