Skip to content
Home Blog Web Design All About WordPress Custom Page Templates

All About WordPress Custom Page Templates

  • Web Design
Blueprint Digital
Blueprint Digital

WordPress is a powerful CMS, and it happens to be my personal choice as a web developer. At Blueprint, I have a chance to do custom WordPress theme development for clients. Some custom themes are simpler than others, and that depends on the each clients’ needs. Sometimes, when I am working on a custom WordPress theme, I find myself needing different templates for different Pages. That is where custom WordPress Page Templates come in.

What are custom Page Templates?

 

There is already a default Page Template in most WordPress themes called page.php which defines how a Page would look. If you have a custom Page Template, you can choose to use it when you are creating a Page in your WordPress dashboard to have it look different from the default Page.

Creating custom Page Templates are easy. All you do is place this in the very beginning of the custom Page Template:

<?php
/*
Template Name: Custom Template Name
*/
?>

Using custom Page Templates in WordPress theme development

One of the things I do often is create different banners for different pages. Let’s say I have a page template called custom.php for a custom Page Template. I can use WordPress conditional tags to define how banners will look different on Pages using custom.php.

<?php if(is_page_template('custom.php')) { ?>
<div id="banner" class="custom-page">
</div>
<?php } ?>

Let’s say I have a different background image for custom.php. I can define that through CSS in different ways. One way is to create a new stylesheet and use a conditional tag to use it on custom Page templates. Or I can just include the CSS in the main stylesheet, style.css.

To use the second method, the <body> tag needs to look like this:

<body <?php body_class(); ?>>

This function includes different CSS classes in the body tag automatically depending on which page you are seeing on a WordPress-installed website. On a Page using custom.php, you should see this class in the code: page-template-page-landing-php. What you would do then in style.css is this:

body.page-template-page-landing-php {
background-image: url("images/custom-background.jpg");
}

Conclusion

WordPress offers a lot of ways to customize it, and, along with making custom WordPress plugins, custom Page Templates are one way to customize WordPress to your needs. Learning about how to use custom Page Templates in WordPress development could really help bring your vision to life.

Ready to Dominate Online and Grow Your Business?

Schedule time to connect with Blueprint about your online goals, or request a free review of marketing campaigns.

Related Posts

The B2B Lead Generation Funnel: From First Touch to Closed Deal

The B2B Lead Generation Funnel: From First Touch to Closed Deal

Most B2B marketing teams can generate leads. Fewer can predict them. The month a big trade show or a strong campaign lands, the pipeline looks healthy; through the quiet months that follow, sales starts asking where the opportunities went. The difference between a lucky pipeline and a predictable one is whether you treat lead generation[...]
Creating Better and Faster Landing Pages with AI

Creating Better and Faster Landing Pages with AI

Landing pages have always been one of the most important assets in a performance marketing program. They can support SEO campaigns, email campaigns, sales enablement, product launches, event promotion, and plenty of other initiatives. But for teams focused on paid media and lead generation, landing pages carry even more weight because they often determine whether[...]
What Makes a Great Website Design for Healthcare Providers?

What Makes a Great Website Design for Healthcare Providers?

A visitor forms a first judgment about a website in about 50 milliseconds. For a healthcare practice, that split second carries more weight than it does almost anywhere else, because the people arriving are rarely in a casual mood. Most have already met the practice online before they ever meet the provider, comparing options and[...]
Previous
Next

Partner with BLUEPRINT to reach your online goals, grow your business and reshape your story.

Get in touch with BLUEPRINT

Reach out to request a discovery call, a free campaign review, or for all other inquiries.

Subscribe to our newsletter