只需添加以下代码片段到你当前主题的functions.php文件
1 add_filter(‘widget_text‘, ‘php_text‘, 99); 2 function php_text($text) { if (strpos($text, ‘<‘ . ‘?‘) !== false) { ob_start(); eval(‘?‘ . ‘>‘ . $text); $text = ob_get_contents(); ob_end_clean(); } return $text;}
原文:http://www.cnblogs.com/shenjieblog/p/5061064.html