Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #425555

    Hi,

    Am trying to enable php code in the text block and came across this code for my functions.php class but it doesnt seem to work in the Enfold theme, maybe the “widget_text” reference is incorrect? I know of plugins that will work but would prefer not to use.

    
    add_filter('widget_text','execute_php',100);
    function execute_php($html){
        if(strpos($html,"<"."?php")!==false){
            ob_start();
            eval("?".">".$html);
            $html=ob_get_contents();
            ob_end_clean();
        }
        return $html;
    }
    

    Thanks,
    Mick.

    #426133

    Hi micknolan!

    Your saying that works in the default theme but not in Enfold?

    I would try looking inside a plugin that does this, https://wordpress.org/plugins/exec-php/, to figure out how they do it and then copy whatever you need.

    Regards,
    Elliott

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.