[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$f1br9afLDBZrBbkNU7xkaoinnsLwKY1BAgr5r4e7tS04":3},{"slug":4,"display_name":5,"profile_url":6,"plugin_count":7,"total_installs":8,"avg_security_score":9,"avg_patch_time_days":10,"trust_score":11,"computed_at":12,"plugins":13},"mechabyte","Mechabyte","https:\u002F\u002Fprofiles.wordpress.org\u002Fmechabyte\u002F",1,70,85,30,84,"2026-04-05T14:55:20.794Z",[14],{"slug":15,"name":16,"version":17,"author":5,"author_profile":6,"description":18,"short_description":19,"active_installs":8,"downloaded":20,"rating":21,"num_ratings":22,"last_updated":23,"tested_up_to":24,"requires_at_least":25,"requires_php":26,"tags":27,"homepage":33,"download_link":34,"security_score":9,"vuln_count":35,"unpatched_count":35,"last_vuln_date":36,"fetched_at":37},"mb-youtube-videos","(MB) YouTube Widget","1.05","\u003Cp>The YouTube videos widget lets you quickly and easily display your most recent YouTube videos in your blog’s sidebar.\u003C\u002Fp>\n\u003Ch3>Features\u003C\u002Fh3>\n\u003Cul>\n\u003Cli>The YouTube videos widget is fully-based on the WordPress \u003Ca href=\"https:\u002F\u002Fcodex.wordpress.org\u002FPlugin_API\" rel=\"nofollow ugc\">Plugin API\u003C\u002Fa>.\u003C\u002Fli>\n\u003Cli>Uses hooks and filters to allow for maximum hackability by theme designers and developers.\u003C\u002Fli>\n\u003Cli>Organized straightforwardly so that it’s easy to modify and style.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>Usage\u003C\u002Fh3>\n\u003Cp>The YouTube videos widget is ready to use as-is, although you can easily customize it to your liking with a bit of code.\u003C\u002Fp>\n\u003Cp>You can also insert a plain list of your recent videos into posts and pages with the shortcode \u003Ccode>mechabyte_youtube\u003C\u002Fcode>. For example, to load \u003Cstrong>5\u003C\u002Fstrong> videos from \u003Cstrong>freddiew\u003C\u002Fstrong> that \u003Cstrong>open in new tabs\u003C\u002Fstrong>, you’d use \u003Ccode>[mechabyte_youtube username=\"freddiew\" videos=\"5\" tab=\"true\"]\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch3>Custom Styles\u003C\u002Fh3>\n\u003Cp>The YouTube videos widget loads it styles by hooking into WordPress’ \u003Ccode>wp_enqueue_scripts\u003C\u002Fcode> action. To remove the default styling you need to remove the our \u003Ccode>enqueue_scripts\u003C\u002Fcode> function from the hook.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>    remove_action( 'wp_enqueue_scripts', array( 'mechabyteYouTube', 'enqueue_scripts' ) );\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>Custom Output\u003C\u002Fh3>\n\u003Cp>The end user has two options of displaying their YouTube videos: in plain or decorated lists. When modifying the output of the plugin you must use one of two filters that this plugin uses: \u003Ccode>mbYT_construct_plain\u003C\u002Fcode> and \u003Ccode>mbYT_construct_decorated\u003C\u002Fcode>. Before you add your own functions to either filter, you must remove the default ones that are used automatically: \u003Ccode>mbYT_construct_plain_default\u003C\u002Fcode> and \u003Ccode>mbYT_construct_decorated_default\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>    remove_filter( 'mbYT_construct_plain', array( 'mechabyteYouTube', 'mbYT_construct_plain_default'), 10, 3  );\n    remove_filter( 'mbYT_construct_decorated', array( 'mechabyteYouTube', 'mbYT_construct_decorated_default'), 10, 3  );\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Now it’s time to get creative. When creating a function that will loop through the videos you have complete control over how you want to display the content. Just keep in mind that in the end, you should be outputting \u003Ccode>\u003Cli>\u003C\u002Fcode> elements. When filters are being applied to the YouTube content, there are three arguments that are being passed through: \u003Ccode>$youtube_videos\u003C\u002Fcode> (\u003Ccode>array\u003C\u002Fcode>, the array of videos), \u003Ccode>$number\u003C\u002Fcode> (\u003Ccode>integer\u003C\u002Fcode>, the number of videos the user wishes to display), and \u003Ccode>$tab\u003C\u002Fcode> (\u003Ccode>boolean\u003C\u002Fcode>, a true\u002Ffalse value of whether or not the user wants to open video links in a new tab).\u003Cbr \u002F>\nKeep in mind that you have access to the following pieces of information when creating your video loop:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>    $item['title'] \u002F\u002F Video title\n    $item['videoID'] \u002F\u002F Video ID\n    $item['viewCount'] \u002F\u002F Video view count\n    $item['published'] \u002F\u002F Video publish date -- UNIX\n    $item['duration'] \u002F\u002F Video duration in hh:mm:ss\n    $item['numLikes'] \u002F\u002F Video likes count\n    $item['link'] \u002F\u002F Video link\n    $item['image']['default'] \u002F\u002F 'Default' thumbnail (low quality)\n    $item['image']['mqdefault'] \u002F\u002F Medium quality thumbnail\n    $item['image']['hqdefault'] \u002F\u002F High quality thumbnail\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Here’s an example of some code that adds a custom function to our \u003Ccode>mb_construct_plain\u003C\u002Fcode> filter (assuming we’ve already removed the default functions). Keep in mind the \u003Ccode>3\u003C\u002Fcode> at the end. That lets WordPress expect our three arguments that will be passed through. Check out WordPress’ \u003Ca href=\"https:\u002F\u002Fcodex.wordpress.org\u002FFunction_Reference\u002Fadd_filter\" rel=\"nofollow ugc\">add_filter()\u003C\u002Fa> page for more info.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>    add_filter( 'mb_construct_plain', 'construct_plain_example', 10, 3 );\n\n    function construct_plain_example( $youtube_videos, $number, $tab ) {\n        $output = '';\n        foreach( $youtube_videos as $youtube_video ) {\n            \u002F\u002F If we've reached the user's display limit, end the loop\n            if( $i == $number )\n              break;\n            $output .= '\u003Cli>';\n            $output .= '\u003Ca href=\"' . . '\"';\n            \u002F\u002F If the user has selected to open videos in a new tab, specify the link target\n            if($tab) {\n              $output .= ' target=\"_blank\"';\n            }\n            $output .= '>';\n            $output .= $youtube_video['title'];\n            $output .= '\u003C\u002Fa>';\n            $output .= '\u003C\u002Fli>';\n\n            $i++;\n          }\n        return $output;\n    }\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Pretty basic, but it allows you to see a general example of how to loop through the objects and return the modified data.\u003Cbr \u002F>\nThe above code will produce a list element like this one:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>    \u003Cli>\u003Ca href=\"http:\u002F\u002Fwww.youtube.com\u002Fwatch?v=3L-rrkyvApU\" target=\"_blank\">Real Life Portal Gun\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Fcode>\u003C\u002Fpre>\n","The YouTube videos widget lets you quickly and easily display your most recent YouTube videos in your blog's sidebar.",12374,74,3,"2013-08-02T00:54:00.000Z","3.6.1","3.0","",[28,29,30,31,32],"recent-videos","social","subscribe","videos","youtube","http:\u002F\u002Fwww.mechabyte.com","https:\u002F\u002Fdownloads.wordpress.org\u002Fplugin\u002Fmb-youtube-videos.1.05.zip",0,null,"2026-03-15T15:16:48.613Z"]