【发布时间】:2015-04-12 06:01:04
【问题描述】:
我是 wordpress 插件的新手,我在笔记本电脑上的 wamp 服务器上运行 wordpress,我已经在我桌面上的同一台服务器上的 wordpress 站点(站点名称:lifog)上编写并激活了这个。用插件编写的功能应该在每个帖子中添加图像,但它不起作用。请帮助更正代码。
我检查了图片来源,没问题。
我的插件在以下地址:
wamp/www/wordpress/wp-content/plugins/Wpplugin
文件名为addimage.php
插件代码如下:
<?php
/*
Plugin Name: Add Image
Plugin URL:http//wordpress
Version: 1.0
Author: wordpress
Author URL: http://localhost/wordpress
Description: This plugin automatically adds an image at the beginning of every post
*/
function addImage($post)
{
$imagewithtext="<img src='http://localhost/wordpress/wp-content/themes/twentyfifteen/Images/veer.jpg' height='70px' width='70px' align='left'>";
$imagewithtext=$post;
return $imagewithtext;
}
add_filter("the_content","addImage");
?>
【问题讨论】: