Wordpress功能插件

时间:2014-05-20 08:38:35

标签: php wordpress wordpress-plugin

我正在尝试编写一个Wordpress功能插件,但我仍然坚持如何继续。这是一个HTML5视频插件,我想将它集成到任何Wordpress帖子/页面。这就是我到目前为止所做的:

<?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 style="display:none;" class="html5gallery" 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');

?>

我安装了插件,但是当我在页面/帖子上添加Shortcode时,没有出现任何内容。

1 个答案:

答案 0 :(得分:0)

这里有一些wordpress短代码。

/*
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');

?>

现在,如果您将 [wordpress_video_gallery] 添加到您的网页或帖子中,您可以在此页面中查看您在 video_gallery 方法中设置的输出或发布。

相关问题