2014-05-20 134 views
0

我想寫一個Wordpress功能插件,但我卡在如何繼續。這是一個HTML5視頻插件,我想將它集成到任何WordPress的帖子/頁面。這是我做過什麼至今: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'); 

?> 

我安裝了插件,但是當我添加上一個頁面/後沒什麼簡碼的出現。

+0

你使用了什麼插件?他們建立了一些「簡碼」。你需要在你的文章或頁面上定義。 – Ranjith

+0

爲什麼你的HTML在空中(任何函數之外)?如果你轉到文檔(http://codex.wordpress.org),你會找到解決方案。請注意,我們有一個專門的網站,以[wordpress.se] – brasofilo

+0

@brasofilo我更新我的問題 - 我遇到的問題是,當我打電話短代碼沒有任何顯示 – user3492795

回答

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方法的輸出。