How to create a custom PHP page in WordPress ?
Do you want to create a custom page in WordPress? You have seen that many WordPress sites have different layouts for different pages. With a custom page, you can have different layout in appearance from regular pages in WordPress. In this article, we will show you how to create a custom page in WordPress.
Creating a Custom Page in WordPress Theme Folder
In your theme folder create PHP file and in the starting of the file put the given code
<?php /* Template Name: CustomPage */ ?>
You can put your desired template name instead of “CustomPage”.
Creating a Custom Page in WordPress Root Directory
When you don’t want to use the template for the theme and want to create PHP file and use it for other purpose rathor than website, you can create a PHP file in root directory and put the given code in it.
<?php require_once(dirname(__FILE__) . '/wp-config.php'); $wp->init(); $wp->parse_request(); $wp->query_posts(); $wp->register_globals(); $wp->send_headers(); // Your WordPress Functions here... echo site_url(); ?>
Provide you valuable comment so that we can update the blog as per that.