How do you create a custom PHP page in WordPress?
-
I don't want to create a template - just newpage.php. do I have to register it with wordpress?
-
Answer:
You can name your file newpage.php - put it in your theme directory in wp-content. You can make it a page template (see http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates) or you can include it in one of the php files in your theme, such as header.php or single.php. Even better, create a child theme and put it in there, so you leave your theme code alone and it's easier to update.
Leora Wenger at Quora Visit the source
Other answers
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: Create a page call it my-custom-page.php and save it under your theme directory. Now, edit this php file and write the following line at the top of the page <?php /* Template Name: My Custom Page */ ?> Write your PHP code under the custom page definition line, you can call your other WP template, functions inside this file. Start like <?php require_once("header.php");?> or whatever way you are integrating your header and footer to keep the layout consistent. Since this is a custom page, you NEED TO CREATE A PAGE from WordPress admin panel. Go to Admin => Pages => Add New 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. At right hand side, select Template. Choose My Custom Page from the dropdown. 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.
Ashish Nayyar
Some tips to expand on existing answers: Copy page.php from your current theme and use that as the start point for your custom page. Make sure to add: /* Template Name: XXXXXX */ to make it show up in the admin interface! Handiest tip: prefix your filename with e.g. "tpl" - "tpl-newpage.php". This just makes your custom templates easier to find, and remember which are the ones you made and which came with your theme!
Adam Marshall
i use a cheat method - go to your files on your hosting plan -select a current php - say a template -copy it -modify it -rename it
Malita Jones
Related Q & A:
- How to dynamically create a PHP class name on the fly?Best solution by stackoverflow.com
- How can I make a dynamic web page in PHP?Best solution by Yahoo! Answers
- How do i create a Yahoo web page?Best solution by iwebhostingplans.com
- How do I create a new Wikipedia page?Best solution by wiki.answers.com
- How do I create a custom theme?Best solution by windows.microsoft.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.