I remember some months ago i was trying to execute PHP code within a blog post i was crafting. i later abandoned the writing of the article as i couldn’t find a way to run the PHP codes.
Am going to share some plugins to help execute and process PHP codes within WordPress post, pages, and Widget sidebars.
Had it been i knew of these plugins as at that time, that abandoned post would have gone live.
By default, the Text widget only support text and HTML. With this plugin activated, PHP and shortcode would be supported.
To execute PHP in text Widget, ensure the PHP code to be executed is encapsulated in between PHP opening and closing tag <?php … ?>
This plugin adds a text widget that is capable of displaying and executing PHP codes. Conditional tags are included in this plugin to specify where the php code will display.
To use, install and activate it, drag the Daiko’s Text Widget to your sidebar and add your own content including php code if needed. Optionally specify whether to display only on home, pages, posts, posts in category(-ies) or category archives. Specify even more if you like with slug/ID/title.
The normal Text widget allows you to insert arbitrary Text and/or HTML code. This allows that too, but also parses any inserted PHP code and executes it. This makes it easier to migrate to a widget-based theme.
All PHP code must be enclosed in the standard tags for it to be recognized.
The Exec-PHP plugin executes PHP code in posts, pages and text widgets. it has great configurable features such as: Restrict execution of PHP code in posts and pages to certain users by using roles and capabilities; Information about which users are allowed to execute PHP with the current security settings; Executes PHP code in the excerpt and the content portion of your posts and pages; Works in your newsfeeds.
Visit bluesome.net for plugin documentation/
Using this plugin you can execute arbitrary PHP code using shortcodes in your posts, pages, comments, widgets and RSS feeds, just like manually defined shortcodes. The shortcodes and associated PHP code are defined using the settings of this plugin. It is possible to parse and use shortcode parameters and to use shortcode content. Defined shortcodes can be deleted and disabled.
This plugin executes PHP inside posts, pages and text widgets. Add filters and actions using custom fields. Use
<?php .... ?>to execute PHP.