WordPress is on of the best blogging platform and PhpPot also uses it as a platform. I am planning to write a lot more on WordPress and this tutorial is first from that series.
This is the scenario, we have a custom PHP page which we want to integrate with the WordPress blog. Our PHP file which we are going to integrate may not use any of the WordPress APIs.
We can start with a sample file and copy page.php, rename it on your choice and put it inside the theme folder ../wp-content/themes/mytheme/
This new file should start with the following content and then followed by the custom PHP content. This is the WordPress template.
<?php /* Template Name: MyTemplate */ /* other PHP code here */ ?>
Remember to upload this to the theme folder. Now the WordPress template is ready.
Click the “Pages” link from the WordPress Dashboard. The template we created can be used to create this new page. We can give the Page name and choose the “Template” from the drop-down from the “Page Attributes” section.
There the PHP-page we uploaded will come with the “MyTemplate” listed in the drop down.
Now publish. Here we go, we have created a WordPress PHP page using our custom code. Whenever this page is linked, our custom PHP code will get executed. We can create any number of WordPress pages using this template.
A real time scenario is we can construct a sitemap page using this WordPress template option.