WordPress Tips, Tricks and Techniques

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){
      ob_start(); eval("?".">".$html); 
   return $html; 

For example:

Note that you’ll want to be sure to use the [Text] tab, not [Visual].

Leave a Reply

Your email address will not be published. Required fields are marked *

There is no need to be confused, frustrated, or waste time with WordPress issues. I’ll be glad to help with phone or screen sharing. I charge $2/minute, with no minimum. The typical call runs 9 minutes ($18). If I can’t efficiently solve your problem, there’s no charge for the call. Contact me any time at (805)-843-5353. You’ll enjoy my friendly, informative manner! – Jeff