Right this moment, I had to make use of a customized PHP script that I created some time in the past in a brand new WordPress software. As a substitute of creating a WordPress plugin to deal with this current code, I select as a substitute to make use of WordPress straight inside my script.
Utilizing WordPress inside your script is a superb choice in case you have a variety of customized PHP code.
When you have got a big PHP code base out of your earlier growth efforts. There are sometimes different libraries inside your code, comparable to Symfony, Zend Framework, Pear, and so forth, that you do not need to take aside. You might have working code and also you need it to remain collectively.
In my case, I had created a type for information assortment for a shopper. However this was no unusual type. It had over 100 type variables. They have been made up of textual content enter, radio packing containers, checkboxes, and textarea’s. I needed to make use of this kind straight inside my WordPress software. Plus I needed the mixing to simple.
The answer was really fairly easy.
Present PHP Code
For instance, assume that is my current PHP code (it’s a easy script for example this level).
However the issue is, that’s solely the shape to gather the information. What about the appear and feel of the prevailing website. How can I get the above code to appear to be the identical template format of my WordPress software.
For instance, one answer is so as to add the uncooked HTML. However that’s each time consuming, and it’s not dynamic. If the WordPress template modifications, I’ve to go in right here and manually change it once more. Not one thing I need to do.
My PHP Type Web page