The Blog
Ninjas For Hire

Ninja Embed WordPress Plugin

We’ve been doing a lot of WordPress projects recently and one thing stood out as something we needed to enable us to provide our clients with an easier way to embed media in their posts and pages.

We decided to create a WordPress plugin that would not only allow the user to easily embed media from YouTube, Vimeo, Yahoo Video and Soundcloud into their posts, but also allow us as developers to use it as a function in the our WordPress template files to embed videos in custom content types and other filters.

The plugin currently supports YouTube, Vimeo, Yahoo Video and Soundcloud. We hope to be able to add more online media services soon.

Installation

  1. Copy the PHP file from the zip file at the bottom of this post into your WordPress “plugins” folder.
  2. Log in to your installation of WordPress.
  3. Go to the “Plugins” menu and activate the plugin called “Ninja Embed Plugin”
  4. Enjoy!

How do users use it?

To embed a piece of media in a post or page you simply need to add the following shortcode to you post or page content:

[media link=”http://www.youtube.com/watch?v=EojN6r2VSR4″]

You can also set a custom width and height to your media by adding the width and height parameters to the shortcode:

[media width=”800″ height=”600″ link=”http://www.youtube.com/watch?v=EojN6r2VSR4″]

You can remove the container around the embed code by setting the container to false(default is true):

[media container=”false” link=”http://www.youtube.com/watch?v=EojN6r2VSR4″]

NEW!

As of version 2.0 you can now easily embed video in your site’s widgetized areas (like the sidebar) using the new Ninja Embed Widget that is now included in this plugin.

How do developers use it?

Don’t worry, we did not forget about the developers. :)

To embed a piece of media somewhere in the code you simply need to add the following function to the template:

media_embed(‘http://www.youtube.com/watch?v=EojN6r2VSR4′)

You can also set a custom width and height to the media by adding arguments for width and height respectively:

media_embed(‘http://www.youtube.com/watch?v=EojN6r2VSR4′, 800, 600)

It is also possible to remove the container around the embed code you can set the container to false(default is true):

media_embed(‘http://www.youtube.com/watch?v=EojN6r2VSR4′, 800, 600, false)

OR if you don’t want to set the width and height and just remove the container

media_embed(‘http://www.youtube.com/watch?v=EojN6r2VSR4′, ”, ”, false)

Download the plugin!

You can download the plugin straight from the official WordPress plugin page here:

Download!





Read more