Adding custom php code
-
I’m looking for a simple answer to a simply issue – hopefully conforming to WordPress Best Practices (if at all possible).
I don’t want to WRITE a plugin or a widget. If I need to USE one, that’s fine, but I don’t want to get in to new syntax if I can at all possibly avoid doing so.
My desire is to be able to include my forms and form processing in to pages in the simplest way possible, while keeping all my custom code in a separate directory on the site. So my WP install and the site home is http://domain.com/wordpress, which means that home is http://domain.com/wordpress/index.php. I have all my custom stuff in http://domain.com/wordpress/my-includes
I have been using Exec-PHP plugin in the past and it worked fine for this as long as I was including a file in the site root (http://domain.com/myFile.php), but now I’m having trouble properly referencing the file (Don’t know how to get to it … do I use /my-includes/file.html, ../my-includes/file.html, my-includes/file.html … what? It seems that everything I try comes up with a php warning and fatal error that the file is not being found.
The one exception is when I use site_url() . /my-includes/file.html
When I try to reference the file in that manner, I get an error that http:// is not allowed.So what IS the right way to do what I want to do? Can I include custom html or php without a plugin? Is there a better plugin? Help!
Thanks!
Jeff
The topic ‘Adding custom php code’ is closed to new replies.