Category: PHP

  • PHP In Your Posts and Pages

    With the addition of the free “Insert PHP Code Snippet” plugin by xyzscripts.com, you can put this code in your functions.php file, then you can add php code directly into Text widgets. This will work with classic themes and block themes such as Twenty Twenty-Two. To insert PHP, select XYZ PHP Code (which is not…

  • PHP In Your Widgets, Classic

    In classic WordPress themes, you can put this code in your functions.php file, then you can add php code directly into Text widgets. function php_in_widgets($html){ if(strpos($html,”<“.”?php”)!==false){ ob_start(); eval(“?”.”>”.$html); $html=ob_get_contents(); ob_end_clean(); } return $html; } add_filter(‘widget_text’,’php_in_widgets’,100); For example: Note that you’ll want to be sure to use the [Text] tab, not [Visual].