tags:

views:

63

answers:

2

I'm in the process of integrating certain functionality into a WordPress site. I'm looking for a way to get this feature to work within a WordPress environment. (It's basically a page that lets users search certain things in a database.)

The site's current CMS allows me to insert custom PHP code into a page, so I wanna know if it's possible to insert PHP code into WordPress pages. Or would you recommend a different approach, perhaps?

+1  A: 

I use this plugin to execute php code, http://bluesome.net/post/2005/08/18/50/

DavidYell
Great! Exactly what I was looking for. But I'm having second thoughts about security. If a hacker manages to log in to the WordPress admin, they can run any PHP code they want. I'm looking into Martin's suggestion; in the meantime I'll have you know that I've voted up both your and Martin's answer.
Pieter
Thanks! Hope you can find something which works for you. I guess you could always extend the plugin and add some more secure code in there. Alternatively beef up the wordpress security with some ip restriction or similar if you have a single user and static ips :)
DavidYell
That sounds like a lot of work for a relatively small snippet of PHP code, but I'll keep that in mind for future projects that require a solution like the one you described.
Pieter
+2  A: 

Could you not create a custom template for the page?

Martin Bean
I'm not sure. The web page has to fit into the regular page hierarchy, so I don't think it's possible.
Pieter
Wait, you're right! http://www.davidrisley.com/how-to-custom-page-template-wordpress/ Thanks!
Pieter
No problem. I should have been more specific and said custom page template. You should be able to then select the template's name from a drop-down list in WP-Admin when you create a new page.
Martin Bean
I have implemented it and it works way better than I imagined. I love WordPress.
Pieter