Sometimes you need a simple or even sophisticated script on your website to provide your audience something that’s not easily available in WordPress. But you don’t need to interact with the API, or use a plugin.

Just follow the steps listed below to get the PHP running:

First, duplicate page.php in your theme folder (under /wp-content/themes/themename/).

Rename the new file as templatename.php (where templatename is what you want to call your new template!). Enter the following at the top of the new file:

<?php
/*
Template Name: templatename
*/
?>

Screenshot

You can modify the code in this file using any editor to include other files or whatever you need.

Then create a new page in your WordPress site, and in the page editing screen you’ll see a ‘Template’ dropdown in the ‘Attributes’ widget to the right. Select your new template and publish the page.

Your new page will use the php code defined in templatename.php and execute the code as soon as you open the page.

 

 

 

Have fun!

 

Leave a comment