WordPress custom page templates have become increasingly popular over the years. While it is true that most WordPress themes have several available page templates already built-in, there are still many themes that don’t.
Custom page templates for WordPress pages are a way of building a page that is different from the default style. This can be done a couple of different ways.
The Sydney theme is designed for companies and freelancers who want to present a strong.
A Search Page is a WordPress Page with a custom Page template to give users more information for searching your site. Things You Need to Know Different WordPress Themes feature different template files. Some include a search.php template file. Since the page template slug is stored inside the postmeta for any post that has been assigned to a page template, it is possible to directly query the postmeta to see whether any given page has been assigned a page template. This is the method that ispagetemplate uses internally. WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up. Sign up to join this community. Anybody can ask a question. Create search result template for custom post type ( archive-search.php ). Basically, you need to include the Wordpress loop in your search.php template to loop through the search results and show them as part of the template. Below is a very basic example from The WordPress Theme Search Template and Page Template over at ThemeShaper.
If you are good with PHP, then you can code WordPress custom page templates from the ground up. However, many of us are looking for an easier solution for adding or creating custom page templates in WordPress.
In this tutorial, I will show you how you can create or add WordPress custom page templates to your theme by using a plugin.
WP Page Templates
There is a solid plugin I found called WP Page Templates. Simply put, this plugin allows you to create and add custom page templates to your WordPress website. The plugin is simple to use.
It comes loaded with a lot of great functions. Some of the main features include:
- Ability to add a left sidebar to pages
- The ability to add a right sidebar to pages
- Add left and right sidebar to pages
- You can add a sidebar below the content
- Add sidebar above the content
The plugin also sets widgets into the widget area of your WordPress admin dashboard and allows you to fill out the sidebars however you see fit.
Install and Activate WP Templates
In order to add and create custom page templates in WordPress, you need to install and activate the WP Templates plugin. You can do this by searching for it in the WordPress plugin repository located in the admin area of your Website.
Once the plugin has been installed and activated you will see a “WP Templates” link in the left sidebar area of your WordPress admin dashboard. Go ahead and click on it.
Adding Custom Page Templates
When you click on the WP Templates link, you are taken to a quick rundown of the plugin. There is no setup. That is to say, there is no additional configuration required.
From this view, you can click on the “Click Here” button to create a new page. This will simply open a new page to create.
Or, go to pages and create a new one from there. You can also configure already existing pages and add custom page templates to those as well.
Click on Pages > Add New, to open a new page.
Go about setting your page up how you would like. Add a title, add your content, and create the page to specifics of what you are doing.
However, you will now see that a dropdown box on the right titled “Page layout” now exists.
Simply click on the checkbox next to the layout you want. This will become the custom page template layout that will be displayed.
Note: This plugin only allows custom templates for pages, not posts. However, the pro version of the plugin does allow custom posts templates to be added.
Setting Up Widgets in Your Custom Page Template Areas
To set up the custom page template widget areas, click on Appearance > Widgets.
You will see that several different widget areas have been added. To configure these, simply drag and drop the widgets and content you want in those specific areas.
WP Templates Premium
The free version of the plugin is solid for creating custom page templates. However, if you want a lot of extra ability, as well as custom post template ability, then check out their premium version of the plugin.
Some of the main features that the premium version offers include:
- Hide header on pages
- Hide footer on pages
- Use a Live Page Builder to create amazing templates
- Design your own templates quickly
- Create templates with multiple columns and content
- Create pages with Sliders, Forms, Widgets, and more
- Design and build your pages faster using a Drag and Drop builder
- Create landing pages and Sales pages
- Use the best Live Page Builder for WordPress
- Hide header and footer for Landing Pages
- Hide header and footer for WooCommerce Products
- Create full-width posts
- Create full-width WooCommerce products
The premium version is also tied into the Elementor WordPress page builder.
Creating and adding WordPress custom page templates does not have to be a difficult process. You don’t have to have PHP code knowledge, just the right plugin.
If your WordPress theme does not have the custom page template you want, then give this process a try.
Have you built custom page templates using code before? Have you found that using a plugin streamlines the process?
Author: Jeremy Holcombe
Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks.
Was this article helpful?
Update: We’ve created a second edition of this article, with updated code samples and coverage of the latest theme development techniques. Check it out at The WordPress Theme Search Template and Page Template. It’s part of The ThemeShaper WordPress Theme Tutorial: 2nd Edition.
The Search Template and The Page Template are vital to any complete WordPress Theme. And they’re both really easy to code. For both these two Templates we’ll start with our template-template again.
But, of course, each one is going to take it’s own different path.
The Search Template
search.php we’re going to reintroduce the loop back into our Template. This time with an IF statement—in case we don’t have any posts to loop through.
Here’s how it’ll work: IF we have posts, or, in other words, if there are posts that match the terms we’re searching for, THEN loop through them, sorta just like in
index.php, but IF we don’t have posts to loop through, or, if there aren’t any posts that match our search terms, give our searchers another chance at this searching business.
In code, it would look like this:
Pretty straightforward, right? Almost.
I like to keep all my index-ey Templates the same: Post Title, Meta, Content (or excerpt), Utility links. But when WordPress searches for posts it also searches through Pages, which don’t need the post meta or utility links displayed. So, in our loop, we’re going to check and see if we’re dealing with a post or a page.
Wrap any code with that IF statement and it will only show if we’re dealing with a page. Now that we understand what’s going on, here’s what the #content div of our search template will look like:
The Page Template
You know what the Page Template is for. WordPress thinks of it as a post out of chronological order. We think of it as, well a page. But largely, it’s defined by what it doesn’t have: all the usual trappings of a blog post.
Except comments. Sometimes pages have comments. I don’t like them there. You might one day. So we’ll have to deal with that somehow. How about with … custom fields. If you want comments on a page you can add a custom field with Name and Value of “comments” to your page. Sounds good to me.
Here’s what you’ll need to for a perfect WordPress Page Template:
How To Create a WordPress Theme
This post is part of a WordPress Themes Tutorial that will show you how to create a powerful WordPress Theme from scratch. Read it from the beginning and code yourself up something awesome.
Wordpress Custom Search Results Page Template
One Page Template Wordpress
- The Search Template & The Page Template