...
  • Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp
KEEP IN TOUCH

Most Popular

  • osTickets > Reports v4.2 (18057)
  • HTPC > Setup Windows 7 as a Media Center with XBMC (10964)
  • osTicket > View headers for original email message (4175)
  • WebDev > Allow PHP in Wordpress Widgets (3616)
  • Web Dev > Password protect webpage(s) with PHP & LDAP (2475)

Posts tagged widget

WebDev > Allow PHP in WordPress Widgets

Jan26
2012
Leave a Comment Written by Scott Rowley

The following will allow for you to post PHP in your widgets:

Place in your functions.php file
Appearance > Editor > Theme Functions (functions.php)

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

ajax loader
Posted in Web Development - Tagged allow, functions, php, theme, wordpress
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail

Be Heard!

Authors needed! Feel like sharing your tech wisdom with the world? We are looking to expand our writer base and would love to hear from you. We need articles on any relevant technology/software/media/howto/etc (Well...lets at least hold to the legal stuff ;)

Just email scott (at) sudobash (dot) net

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Sudo Bash Member sites

Des Moines, Iowa Karate Classes
Iowa MMA Tournaments
Iowa SAR
Ooo-er
5point Studios Tattoo & Piercing

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

RSS HowToGeek

  • Week in Geek: Aero Glass Feature will be Removed from Windows 8
  • How to Speed Up Web Browsing with Search & Bookmark Keywords
  • Geek Trivia: Pagers Were First Developed To Assist Which Professionals?
  • The Best Tips and Tricks for Using Email Efficiently
  • Desktop Fun: Starry Skies Wallpaper Collection Series 2

RSS TheGeekStuff

  • UNIX / Linux Processes: C fork() Function
  • How to Calculate IP Header Checksum (With an Example)
  • How to Encrypt Your Bash Shell Script on Linux Using SHC
  • Intro to DOCSIS Architecture, CM CMTS Protocol for Cable Modems
  • Ettercap Tutorial: DNS Spoofing & ARP Poisoning Examples

RSS LifeHacker

  • DIY Maple-Flavored Pancake Syrup [Breakfast]
  • This Week's Top Downloads [Download Roundup]
  • Make Mini Dutch Baby Pancakes in a Muffin Tin [Breakfast]
  • Pour Vinegar Down Your Drain Every Three Months to Keep Clogs Away [Video]
  • Use the Jelly Pocket Method for a Better Drip-Free PB&J [Food Hacks]

EvoLve theme by Blogatize  •  Powered by WordPress Sudo Bash
By Geeks - For Geeks

Back to Top