The following will allow for you to post PHP in your widgets:
Place in your functions.php file
Appearance> Editor> Theme Functions (functions.php)
// Allow PHP in Widgets add_filter('widget_text', 'php_text', 99); function php_text($text) { if (strpos($text, '<' . '?') !== false) { ob_start(); eval('?' . '>' . $text); $text = ob_get_contents(); ob_end_clean(); } return $text; }
Now you can place php code so long as its within its <?php and ?> tags.
Credit