How to create or use your php page in a third party theme or template

A custom page allows you to have different layout, look and feel from regular pages in WordPress. You can even have it work as full fledged PHP page which is what you want right?
Here is what you should do:
  1. Create a page call it my-custom-page.php and save it under your theme directory.
  2. Now, edit this php file and write the following line at the top of the page
    php /* Template Name: My Custom Page */ ?>
  3. Write your PHP code under the custom page definition line, you can call your other WP template, functions inside this file.
  4. Start like
    php require_once("header.php");?> or whatever way you are integrating your header and footer to keep the layout consistent.
  5. Since this is a custom page, you NEED TO CREATE A PAGE from WordPress admin panel.
  6. Go to Admin => Pages => Add New
  7. Add a page title, depending upon how you have coded the custom page, you might add page body (description) as well. You can fully skip the description if it’s written in the custom php page.
  8. At right hand side, select Template.
  9. Choose My Custom Page from the dropdown.
  10. You are all set! Go to the slug (permalink) created by wordpress and see the page.

@Adam also mentioned handy way to find your custom file especially if you have many in your theme.

Comments

Popular posts from this blog

HOW TO REGISTER FOR SAFETOKEN

How To Get Help In MMM Nigeria - Mavrodi Mondial Moneybox