Creating a New Template

My latest challenge was creating a new page template in my Understrap Child Theme.

The client wanted certain pages to have certain styling in it’s header.

Of course the header is handled in the loop templates rather than the page templates.

Because nothing can ever be simple.

Creating The Template

First you’ll want to copy the “Page-templates” file from the Understrap parent theme.

Then delete all templates within your copy of the file except the page template you use (in my case “fullwidthpage”).

Next rename the template (in my case I renamed it “featurepage”).

Voila you have a new page template to work with.

Styling The Header

Now you can change the look of the content in the “loop-templates/content-page.php” template (import from Understrap if your child theme doesn’t contain this file and template)

This can be targeted to the specific template you want with code like this:

if(is_page_template( 'page-templates/featurepage.php' )) {

}

And you can even apply styles specifically to pages using that template with Additional CSS like this:

body.page-template-featurepage h1 {
	font-size: 1.5em;
}

Leave a Reply