Wistia Player API plugin for wordpress

Hello Guys,

I would like to tell about the Wistia Player API with wordpress Shortcode.

Here is the code for the wistia player API plugin for wordpress.

Following steps you must be follow.

Step 1:

Just copy and paste this php code with new file. File namis yours.

Step 2:

Upload that file to your wordpress wp-content folder.

Step 3:

Go to the back-end of your wordpress site and enable this plugin.

Step 4:

Now this plugin is ready to configure. see the left menu with settings tab. Here you can see the wistia player tab. Just go to this page.  You can see the settings for the API key for wistia player .

Step 5:

if you don’t have API key means,  go to this site <a href=”http://wistia.com&#8221; target=”_blank”>http://wistia.com<a/&gt; and register as user in wistia site.

Step 6:

You can use this short-code in post, page and widget.

[wistia clip_id=”32090122″ width=”600″ height=”375″]

You can get the clip id from wistia.com site. You can upload your videos there.

That’s All. Now you can see the video in your wordpress site.


Plugin Name: Wistia Player
Plugin URI: http://wistia.com
Description: Wistia Video player for wordpress .
Version: The Plugin’s Version Number, e.g.: 1.0
Author: Manimaran
Author URI: https://manisanjai.wordpress.com
License: Free
add_action(‘admin_menu’, ‘wistia_player_menu’);

function wistia_player_menu() {
add_options_page(‘Wistia Player Options’, ‘Wistia Player’, ‘manage_options’, ‘my-unique-identifier’, ‘wistia_player_options’);
add_action( ‘admin_init’, ‘register_mysettings’ );

function register_mysettings() {
//register our settings
update_option(“api_user_id”, $_POST[‘api_user_id’]);
update_option(“api_user_password”, $_POST[‘api_user_password’]);
update_option(“api_width”, $_POST[‘api_width’]);
update_option(“api_height”, $_POST[‘api_height’]);

function wistia_player_options() {
if (!current_user_can(‘manage_options’))  {
wp_die( __(‘You do not have sufficient permissions to access this page.’) );
<h2>Wistia Player Settings</h2>

<form method=”post” action=””>

<tr valign=”top”>
<th scope=”row”>API USER ID :</th>
<td><input type=”text” name=”api_user_id” value=”<?php echo get_option(‘api_user_id’); ?>” /></td>
<tr valign=”top”>
<th scope=”row”>API PASSWORD :</th>
<td><input type=”text” name=”api_user_password” value=”<?php echo get_option(‘api_user_password’); ?>” /></td>
<tr valign=”top”>
<th scope=”row”>Default Width :</th>
<td><input type=”text” name=”api_width” value=”<?php echo get_option(‘api_width’); ?>” /></td>
<tr valign=”top”>
<th scope=”row”>Default Height :</th>
<td><input type=”text” name=”api_height” value=”<?php echo get_option(‘api_height’); ?>” /></td>
<tr valign=”top”>
<th scope=”row”>You can use short-code :</th>
<td><strong>[wistia clip_id=”32090212″ width=”600″ height=”375″]</strong></p></td>


<input type=”submit” value=”<?php _e(‘Save Changes’) ?>” />
class lux_wistia {

function shortcode($atts, $content=null) {
‘clip_id’     => ”,
‘width’     => ”,
‘height’     => ”,
), $atts));

$width = get_option(‘api_width’);
$height = get_option(‘api_height’);

$width = ‘600’;
$height = ‘375’;

$api_user_id = get_option(‘api_user_id’);

$api_user_password = get_option(‘api_user_password’);

if (empty($clip_id)) return ‘<!– Lux Vimeo: Invalid clip_id –>’;

$url = “https://api.wistia.com/v1/medias/$clip_id.json&#8221;;

$context = stream_context_create(array(
‘http’ => array(
‘header’  => “Authorization: Basic ” . base64_encode(“$api_user_id:$api_user_password”),
$return = file_get_contents($url, false, $context);
$result = json_decode(“$return”);
global $current_user;
$ss = $width.’x’.$height;
echo ‘<div ><a href=”‘.get_permalink().'”><img src=”‘.str_replace(“100×60″,$ss,$result->thumbnail->url).'” border=”0″ /></a></div>’;
echo ‘<div >’.$result->embedCode.'</div>’;
<style type=”text/css”>
.wistia_class object, .wistia_class embed{
width:<?php echo $width;?>px;
height:<?php echo $height;?>px;

add_shortcode(‘wistia’, array(‘lux_wistia’, ‘shortcode’));


Here is screenshot for the plugin settings:

If you have any clarification about this one, you can contact me via email:



2 thoughts on “Wistia Player API plugin for wordpress

  1. Tried this but got error everytime I tried to activate.

    Parse error: syntax error, unexpected T_STRING in /data10/var/www/vhosts/2355productions.com/httpdocs/wp-content/plugins/Wistia.php on line 14

    Any help?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s