Php Wordpress功能插件
我正试图写一个Wordpress功能插件,但我被困在如何继续。这是一个HTML5视频插件,我想将它集成到任何Wordpress帖子/页面中。这就是我目前所做的:Php Wordpress功能插件,php,wordpress,Php,Wordpress,我正试图写一个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
<?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');
?>
我安装了插件,但当我在页面/帖子上添加短代码时,什么也没有出现。这里是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\u video\u gallery]添加到页面或帖子中,您可以查看在该页面或帖子中设置到video\u gallery方法中的输出。您使用了什么插件?他们构建了一些
短代码
。你需要在你的文章或页面上定义它。为什么你的HTML在空中(在任何功能之外)?如果您转到docs(),您将找到解决方案。请注意,我们有一个专门的网站@brasofilo I更新我的问题-我的问题是,当我调用短代码时,没有任何东西显示在函数中向上移动整个$html,并执行返回$html代码>而不是echo
。PS:我已经清理了我以前的一些房间comments@brasofilo非常感谢,如何在使用herdoc时集成php代码?