Advertisement
arnabkumar

enable_php_in_wp_widget

Apr 2nd, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. <?php //add this below code into your theme’s functions.php
  2. //code for enable php code  in widget
  3. add_filter('widget_text', 'php_text', 99);
  4.  
  5. function php_text($text) {
  6.  if (strpos($text, '<' . '?') !== false) {
  7.  ob_start();
  8.  eval('?' . '>' . $text);
  9.  $text = ob_get_contents();
  10.  ob_end_clean();
  11.  }
  12.  return $text;
  13. }
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement