How To Add PHP Code into WordPress Widgets

I’ve change my blog template and quite satisfied with the combination between WordPress and a brand new BlogNews themes. BlogNews themes came with fully customization option, with flexible widget on every part of template layout. WordPress widget give me a simple way to add some content on the selected place.

One drawback with WordPress widgets is that we couldn’t add plugins or call PHP code within widgets. If you get same problem, the following plugins may help you to manage PHP code within widgets :

  1. PHP-Code-Widget
  2. PHP-Widgetify
  3. Daiko’s Text Widget

Install one of the above plugins (I choose the first choice) with WordPress plugins page, activate it and then voila, you have a new widget, the one like text widget but it can handle PHP code. Don’t forget to insert PHP code inside PHP tags (<? and ?>) if you wish to add PHP function. The widget should also supporting standard plain text and HTML code.

Related Entries

8 Responses for “How To Add PHP Code into WordPress Widgets”

  1. I’ll add these to my list.

    I also recommend Exec-PHP for adding PHP to your widgets.

    Thanks for the list!

  2. [...] Continue reading here: How To Add PHP Code into WordPress Widgets | Spirit of Change [...]

  3. Media says:

    -php error??

  4. I had same problem. Tried lot, but fails every time. Nice guide even to the learner.

    Thanks mate

  5. OfficeVoodooKit says:

    Is there a widget that will allow you to add add_shortcode tags in a widget? For example [CSSBUTTON target="http://www.linktarget.com" color="000000" textcolor="ffffff"]Button Caption[/CSSBUTTON] from the WP CSS Button plugin.

  6. I definitely want to read a bit more soon. BTW, rather good design your blog has, but what do you think about changing it every few months?

    Jessica William

Leave a Reply

About Vavai

Masim Vavai Sugianto Masim Vavai Sugianto, Indonesian, male, 32 years old, born and live in Bekasi-West Java, a small town near Jakarta – main city of Indonesia – since 17 May 1976. Founder of Indonesian openSUSE and Zimbra Community, an adventure, travelling and book lover.



I live in a tropical country, Indonesia that only has two seasons, dry season and rainy season. I love the dry season with bright sunshine and rare rain…There is a joke about the seasons in Indonesia. Indonesia is known as a country with so many season, ie : durian season, mango season, married season and much more...



ContactI'm currently working as an IT support for a small company based on Jakarta. My career has led me to specialize in Sysadmin, networking and software implementation with current focus on Linux and open source area. I have experience on MRP, ERP, Gemba Kaizen, Just in Time, Six Sigma and TQC/TQM. Please use my contact page if you wish to contact me.
Log in - BlogNews Theme by Gabfire themes