Hi,
I think this plugin will solve your problem
https://ww.wp.xz.cn/plugins/classic-text-widget/
Thank you
DS
(@dosolnce)
Thank you. It also solved the problem with the self-destruction of php-codes and scripts in the widgets of the new wordpress.
UPD Ah, no))) I hurried to rejoice. After refreshing the page, the PHP code does not work, as if I saved it in a visual editor.
-
This reply was modified 9 years ago by
DS.
Hi @dosolnce,
PHP codes does not work in text widget.
You can use the following plugin.
https://ww.wp.xz.cn/plugins/php-code-widget/
Thank you
DS
(@dosolnce)
Thank you! But I already solved this problem. For a long time now I’ve included code support in widgets without any plugins, only with the help of code:
function php_in_widgets($widget_content) {
if (strpos($widget_content, '<' . '?') !== false) {
ob_start();
eval('?' . '>' . $widget_content);
$widget_content = ob_get_contents();
ob_end_clean();
}
return $widget_content;
}
add_filter('widget_text', 'php_in_widgets', 99);
So, I just did not immediately realize that the new widget has a new name. I added a line:
add_filter('classic_widget_text', 'php_in_widgets', 99);
And now everything works great.