Jump to content

jacquesdegatineau

New Members
  • Posts

    3
  • Joined

  • Last visited

jacquesdegatineau's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow, you're geniuses, this works perfectly – thank you so much. @gizmola Thanks for your other suggestion as well, I'll have a look and experiment with that API soon, it sounds promising.
  2. @requinix It's 32 videos. That's right, using WordPress I need to use a Shortcode to display the number on the page. @maxxd Because like I said I want to show the sum of multiple View Counts combined as one number, that's why I was wondering if the function could be re-written.
  3. Hello. I want to display one View Count of multiple YouTube videos on my website. I'm not very tech-savvy, but here's a PHP code that I found on this website. With this code implemented in my website's theme file, and a Shortcode, I was able to display the View Count of one video. How does this code need to be changed, so it displays the View Counts of multiple videos of my choosing? Shortcode function: function youtube_view_count_shortcode($params) { $videoID = $params['id']; $json = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=statistics&id=" . $videoID . "&key=xxxxxxxxxxxxxxxxxxxxxxxx"); $jsonData = json_decode($json); $views = $jsonData->items[0]->statistics->viewCount; return number_format($views); } add_shortcode('youtube_view_count', 'youtube_view_count_shortcode'); Shortcode: [[youtube_view_count id="UKuYgIBnqEA"]] I would really appreciate any suggestions. Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.