How to create a custom page in WordPress
Step1: Login to WordPress and select the pages from the sidebar
Step2: Click on Add new at the top of the page to create a new page; this will open a screen like below and enter the following:
a. Enter the page title as this will be your URL.
b. Enter the content you would like to Enter.
Step3: Please note the page id in the URL as we will use it later to create a custom page; in my case, it is ‘16251’. This will be different for different pages.
Step4: Now scroll down a bit and look for the Page attribute in the right sidebar and within the sidebar, look for Template.
Note: If you do not have a template like the above in the page attribute, Don’t worry; I will help you create a template in the sidebar.
Step5: Create a file with the name ‘Chatbot.php’ (Note: you can give any name) and paste the following code and save it in the folder where all the other files are placed in the theme folder using.
Note: Refresh the WordPress page so that new code can start showing up:
Step6. After successfully saving the code in the theme folder, ‘Chatbot Php’ or the name entered above in phpfile will start showing up WordPress sidebar in the template dropdown and select it.
Step7. Select update in the publish section of the right sidebar.
Step8: Open up the permalink in the new tab, and a new custom page will be displayed.
In the end, I would like to conclude if all the steps are followed, then you will easily be able to create a custom page in WordPress in about 2 mins. Also, you can use this code to create index.php while formatting a custom theme.
Moreover, If you follow step 2 & 3, you can easily identify the post_id and page_id in a straightforward way.