Forums

wordTube
[resolved] Number of views (4 posts)

  1. Didier77
    Member
    Posted 1 year ago #

    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

    http://wordpress.org/extend/plugins/wordtube/

  2. Didier77
    Member
    Posted 1 year ago #

    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');

  3. VicioMania
    Member
    Posted 1 year ago #

    can best be explained as you did, when you put it (line)

  4. Didier77
    Member
    Posted 1 year ago #

    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).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic