Put PHP Code in Wordpress Page or Post

31. August 2007 Uncategorized

As many of you know, in Wordpress you can write a post or page only in HTML format. In some cases you may need to put some dynamic code in use. For example today I made a page for Top Posts and I had to put some PHP code into it. So I searched for WP plugins that will let me do that. I found two PHPexec and RunPHP that are made for that purpose. It looks that PHPexec is no more supported by its creator but there is a version for Wordpress 2.x and it got to work for me. I had no success with RunPHP probably because of my hosting settings or my template. I am not sure. You may try both of them and see what works for you.

When you install the plugins you have to activate them and use the Code Editor when posting. It does not work with the standard Visual Editor. The PHPexec is used with <phpcode><?php “your code here” ?> </phpcode> tags. RunPHP does not require some additional tags.

In order both of the plugins to work you have to deactivate “WordPress should correct invalidly nested XHTML automatically” option which you can find in Options->Writing in your Wordpress admin panel.

Thats my experience with this issue. I hope it helps you.

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 1 out of 5)
Loading ... Loading ...

Similar Posts:

1 Responses

  1. Thanks for the info. Unfortunately, neither plugin worked for me.
    What did work was another plugin, which can be found at http://bluesome.net/post/2005/08/18/50/
    Hope this helps.

    22. November 2007 - wbd

Leave a Reply