Hi All,
I used this plug-in with a site having a lot of videos. Is there a way to display the number of views by videos in the site itself (i.e: not in admin panel like statistics but like youtube (xxx views))?
Thanks a lot,
Didier
Hi All,
I used this plug-in with a site having a lot of videos. Is there a way to display the number of views by videos in the site itself (i.e: not in admin panel like statistics but like youtube (xxx views))?
Thanks a lot,
Didier
I have found myself the solution of my question. I have added the following lines in function.php file of my theme:
// Display nb of views of wordtube videos
//
// Usage: [nbviews id=xxx] where xxx is the ID of the video
//
function nbviewswordtube($videoid) {
global $wpdb;
$tables = $wpdb->get_results("SELECT * FROM ".$wpdb->wordtube." WHERE vid = ".$videoid['id']);
if($tables) {
return $tables[0]->counter;
}
}
add_shortcode('nbviews', 'nbviewswordtube');
can best be explained as you did, when you put it (line)
Sorry if I was unclear.
To use the "number of views" feature, you have to
1- Insert the code above in function.php of your theme. You can add it anywhere (just before the final ?> by example).
2- Anywhere, in a post or a page, add [nbviews id=xxx] where xxx is the id of the wordtube media.
By example, if the media ID is 199, type [nbviews id=199]. This will display the counter of views for id 199.
I hope it clarifies.
You can see a sample at http://montereau.egliselacolombe.org/?page_id=85 (sorry it is in French).
This topic has been closed to new replies.