WordPress allows for custom page templates that can display pages differently than the default template. A page template is selected when editing an individual page and templates can be built-in or custom-created. To create a custom page template, copy an existing template file like page.php to a new file, add a template name comment, replace the content call with the actual content code, and customize features like removing the page title. This allows specific pages to have unique styling, columns, or omitted elements like the title.
2. What is a Page template?
You'll probably want most of your website Pages to look about
the same. Sometimes, though, you may need a specific Page, or a group of
Pages, to display or behave differently. This is easily accomplished with Page
Templates.
Selecting A page template?
Your Theme files should include a default page template (named:
page.php). Your Theme may also have one or more custom page templates, for
instance, to display content in wider columns. Or you may have created a custom
template of your own.
3. Steps to Select page template.
Go to Dashboard Pages Edit page
4.
In Edit page area. You will se a widget called “Page attributes”
On the right side. Which have the built in page templates by default. If
you create a custom page template i.e. page template according to your
own needs, that will also appear in the same dropdown menu.
You can select the desired page
template for concerned page and update
the changing. Look and behavior of the
page will be according to the selected
page template
5. How to Create own page template in child?
Adding new page template is very easy in scratch development. You only
have to find some files and copy /paste the code. We will perform this with an
example!
you are supposed to have a well running child theme with all necessary
files. i.e. styles.css etc.
Follow these steps!
1.
Find page.php in the parent theme folder. Copy this file and paste it in
Child theme folder with specific name . We will name this file as “No-title
Page-Template”. As the name describes that the pages with this template
will not have title of the page!
6. Open this file. And look at the code .
You will see the commented code in the start , some conditional
functions and some other code in this file.
Step 2. Delete all commented code and add only following line in the start of your
template file.
/*
Template Name: No-Title-Page-template
*/
7. if you look at the remaining code you can see that there are some get
Functions for other files that are, get_header () , get_sidebar(), get_footer()
etc. Title and post of the page are parts of page contents. Here you can see that
<?php get_template_part ( „ content‟, „page‟); ?>
This is the code taking the content from the content-page.php.
Content-page.php file contains the content of the page, including title posts etc.
8. Step 3. you Find the Content-page.php in the parent theme folder and
open this file in dream viewer or some other code editor.
Copy all the code except commented. And replace this copied code with
<?php get_template_part ( „ content‟, „page‟); ?>
In No-Title-Page-Template file
9. After replacing <?php get_template_part ( „ content‟, „page‟); ?>
With copied code, newly created template file named
“No-Title-Page-Template.php” will look like this.
10. Step 4. Now find the code which is adding the title. And delete it. In our
Template file
Now, Your custom page template is ready. This template will make your site page
not to show the title.