How to insert PHP code in post or page? Some times it is necessary to embed or execute some PHP code in wordpress post, page or sidebar to display some dynamic information. Usually if you add the PHP code in post or page , it will not get executed , instead it will just show the code as it is. There are few useful wordpress plugins available to overcome this barrier.
These plugins helps you to add the PHP code block to your wordpress post, page or widget. These plugins provides custom tags that can be used to wrap the code. During run time these plugins will render and execute the code and will show the required result of the execution where you place the code.
- Must Do Tips To Secure WordPress Blog and Site
- How To Recover WordPress Admin Password or Reset Admin Password?
- Moving WordPress Blog To New Host : Move WordPress Blog in 7 Steps
WordPress plugins to render PHP code in WordPress Post, Page or Sidebar
There are many wordpress plugins that allows you to add PHP code to the Post , Page or Widget. Few of the plugins allows you to insert PHP code in wordpress post or pages and will parse them. Other plugins are for sidebar widgets.
PHP codes in WordPress Posts and Pages
Allow PHP in Posts and Pages
Allow PHP in posts and pages allows you to add PHP functionality to WordPress Posts and Pages. After installation and activation of this plugin you can include PHP in wordpress posts and pages by adding a simple shortcode [php].code.[/php]. This plugin strips away the automatically generated wordpress <p> and <br/> tags but still allows the addition of your own <p> and <br/> tags.
Download Allow PHP in Posts and Pages
Embed PHP in posts
Using Embed PHP in posts wordpress plugin you can easily embed PHP code in posts. After installation and activation to display a code in the article, you can use the PHP code as seen below in the [phpcode] tag.
[phpcode]your php code[/phpcode]
Download Embed PHP in posts
PHP Execution wordpress plugin allows embedding php code inside of posts and pages. Embedded php code will be executed when the post is shown.
Download PHP Execution
Shortcode Exec PHP
Shortcode Exec PHP execute arbitrary, reusable PHP code in posts, pages, comments, widgets and RSS feeds using shortcodes. 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.
PHP codes in WordPress widget sidebar
PHP Code Widget
PHP Code Widget plug-in work like a normal text widget but with PHP aware feature. This plugin allows you to insert PHP code in the widget. It parses any inserted PHP code and executes it. All PHP code must be enclosed in the standard tags for it to be recognized. That means the PHP code should be always between . This is a single file (execphp.php) WordPress plugin.
Download PHP Code Widget
Ad Codes Widget
PHP Text Widget
PHP Text Widget executes PHP code on WordPress default Text Widget. PHP Text Widget allows you to control the text displayed with PHP, eg. showing different ads on different posts, pages, categories and so on.
Download PHP Text Widget
Before you go, subscribe to get latest technology articles right in your mailbox!.