我安装了 Magento 并在 magento root (wp) 的子文件夹下安装了 wordpress。一切正常,除了如果在小部件中定义 php 则无法执行。
我在functions.php中创建了这个短代码:
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter('widget_text','execute_php',100);
此简码通常有效。它已在其他网站上成功测试。我还在 wordpress pages/posts/widgets 中安装了一个 php exec 插件。但是我的小部件中的 php 没有执行。什么都没有出现,但是如果我选择“查看页面源代码”,php 源代码会以红色显示为普通文本。
任何想法?
我正在使用 Fishpig Magento 模块在 Magento 下进行 wordpress 集成。