php - Wordpress Functionality Plugin

319

I am trying to write a Wordpress functionality plugin but I am stuck in how to proceed. This is an HTML5 video plugin and I want to integrate it into any Wordpress post/page. This is what I did so far:

<?php
/*
Plugin Name: plugin
Description: A Video gallery with thumbnails showing trailers
Version: 1.0
License: testing plugin
Author: Testing Users
Author URI: http://www.test.com
*/

$html = <<<HTML
 <script type="text/javascript" src="html5gallery==/html5gallery.js"></script>

 <div  data-skin="gallery" data-width="680" data-height="375">
 <!-- Add Vimeo video to Gallery -->
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>
    <a href="link"><img src="link2" alt="name"></a>

 </div>
HTML;

function video_gallery() {
  echo $html;
}

add_shortcode('wordpress_video_gallery', 'video_gallery');

?>

I installed the plugin but when I add the Shortcode on a page/post nothing is appearing.

254

Answer

Solution:

Here some code for wordpress shortcode.

/*
Plugin Name: plugin
Description: A Video gallery with thumbnails showing trailers
Version: 1.0
License: testing plugin
Author: Testing Users
Author URI: http://www.test.com
*/

function video_gallery() {
// All your html and js code place here.
}

 add_shortcode('wordpress_video_gallery', 'video_gallery');

?>

Now if you add [wordpress_video_gallery] into your page or post you can view the output which you set into the video_gallery method in this page or post.

People are also looking for solutions to the problem: Passing data from php to XML

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.