Support » Plugin: Easy YouTube Gallery » Grabing Multiple Video Ids From Playlist Id

  • Hello,
    Need a help here !

    I am trying to use easy youtube gallery plugin with my specific playlist id instead of multiple specific video ids.
    As, in the plugin shortcode
    id=YT_VIDEO_ID, YT_VIDEO_ID

    So I have created a function in the the plugin file > easy-youtube-gallery.php
    to get the video ids seperated with commas from a specific playlist id using youtube api with json output decoding.

    So my function just echos the multiple video ids separated with commas, Now as the plugin’s shortcode array $atts['id'] should be given by the shortcode id = ... , .... , ...

    How can I call my function in that php to get the video ids, as an example :
    $atts['id'] = myfunc();
    But this is not working !

    It will be so helpful for me if you can direct me to the right direction. Thanks for the plugin and Thanks in Advance !

    • This topic was modified 1 month, 3 weeks ago by  raydvard.
Viewing 1 replies (of 1 total)
  • Plugin Author Aleksandar Urošević

    (@urkekg)

    Hi @raydvard,

    First, you should modify shortcode() method and add support for new parameter that will represent playlist ID, for example pid

    Then in same method around line 134 (before check if parameter id is set) you should check if pid parameter is set and if it is, call your method like:

    $atts['id'] = myfunc( $atts['pid'] );

    Your method myfunc( $pid ){} should get playlist ID from $pid variable provided to method, and after composing one string with video ID’s separated by comma return (not echo) result back to shortcode() method. SO, something like:

    public function myfunc( $pid ) {
        // Here goes your code to get video ID's form playlist
        // and put them in simple array $video_ids
        $id = implode( ',', $video_ids );
        return $id;
    }

    Cheers,
    Aleksandar

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.