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

Is Lead Generation Worth It for B2B Companies?

Is Lead Generation Worth It for B2B Companies?

Qualified leads are the foundation of B2B revenue, but the cost to generate them keeps climbing. Search competition is stiffer, buyer attention is shorter, and more companies are chasing the same decision-makers. When marketing spend rises and pipeline stays unpredictable, the question of whether lead generation is worth it becomes harder to ignore. For companies[...]
Local SEO for Doctors: Get Found by New Patients

Local SEO for Doctors: Get Found by New Patients

When someone needs a new physician, the search usually starts the same way: a quick lookup for a doctor "near me," followed by a glance at the map, the star ratings, and whoever shows up first. Most of those clicks go to the three practices Google features in the map at the top of the[...]
Digital Marketing for Doctors: Grow Your Practice

Digital Marketing for Doctors: Grow Your Practice

Before a patient ever calls your office, they have usually already searched your name, read a few reviews, compared you to two other practices, and looked at your website on their phone. By the time the phone rings, much of the decision is made. Digital marketing for doctors is the work of being present 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