Execute PHP in Wordpress post, page and Widget Sidebar

Posted on 06. Mar, 2009 by Yao Yuan in Wordpress

If you are still struggling on how to insert PHP Codes inside particular blog post, page or a widget sidebar for execution; the following tutorial is for you.

Executing PHP codes in Wordpress Page/Post

Installation

  1. Download phpexec.txt
  2. Rename phpexec.txt to phpexec.php
  3. Upload to /wp-content/plugins/ directory
  4. Activate the plug-in from Wordpress administration menu

Usage

Anywhere in your post/pages where you want to execute a PHP Codes, insert <phpcode> before your php codes and </phpcode> your php codes.

<phpcode>
	<?php
		echo "Current date and time: ";
		echo date("l dS of F Y h:i:s A");
	?>
</phpcode>

Security

If you are running a blog with multiple users, you need to determine who can run this plug-in. Alter the settings in your Administration Menu. Options -> PHPExec

Executing PHP codes in Wordpress widget sidebar

Installation

  1. Download execphp.txt
  2. Rename execphp.txt to execphp.php
  3. Upload to /wp-content/plugins/ directory
  4. Activate the plug-in from Wordpress administration menu

Usage

This plug-in work like a normal text widget except that it allows execution of PHP Codes. You can create up to 9 instances of this widget.

Related Posts

  1. Widgetize non-widget Wordpress theme
  2. How to Fix Unexpected Wordpress Database Table Error
  3. Fix Wordpress automaticlly upgrade wordpress upgrade automatically ‘Could not copy file……’
  4. Wordpress Theme That Mimics Mac OS X Leopard – Leopress
  5. Something Useful for creating a Wordpress theme

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: ,

Leave a reply