WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Related YouTube Videos

Automatically embed YouTube videos that are related to your content.

Other Notes

Developers can also use the API class outside the plugin context, for example in a theme template file. All you have to do is include the class (if it doesn't already exist) and create an object like this:

/* Load the "Related YouTube Videos" API class if it does not exist yet. */
if( !class_exists( 'RelatedYouTubeVideos_API' ) ) {

  $file = str_replace( '/', DIRECTORY_SEPARATOR, ABSPATH ) . 'lib' . DIRECTORY_SEPARATOR . 'RelatedYouTubeVidoes' . DIRECTORY_SEPARATOR . 'API.php';

  if( file_exists( $file ) ) {
    
    include_once $file;
    
  }

}
/* Only continue if the API class could be loaded properly. */
if( class_exists( 'RelatedYouTubeVideos_API' ) ) {

  $RytvAPI  = new RelatedYouTubeVideos_API();
  
  /* Do your configuration */
  $data     = $RytvAPI->validateConfiguration(
    array(
     'relation' => 'postTitle',
     'max'      => '3',
     'width'    => 150,
     'height'   => 150,
     'lang'     => 'en',
     'region'   => 'de',
     'class'    => 'left center inline bg-black',
     'preview'  => true
    )
  );

  /* Search YouTube. */
  $results  = $RytvAPI->searchYouTube( $data );

  /* Generate the unordered HTML list of videos according to the YouTube results and your configuration.  */
  $html     = $RytvAPI->displayResults( $results, $data );
  
  echo $html; // Or do with it whatever you like ;)

}

Requires: 3.0.0 or higher
Compatible up to: 3.8.3
Last Updated: 2014-3-27
Downloads: 10,751

Ratings

5 stars
5 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1