
Create Template in Beaver Themer to Select in WordPress Page Template Field
Learn how to make a Beaver Themer template selectable in WordPress’ Page Attributes –> Template field.
Before Beaver Builder, developers created template files in WordPress that would be used to theme their website. We still use these that either come with the theme or we build ourselves. But, more and more I find myself using Beaver Themer to quickly create themer layouts and templates and assign them to custom post types, pages or groups of pages. Designers, developers and non-techies can can build themes quickly, changing the layout for specific content.
While this can make the template layout process quicker, it adds complexity to assigning new pages to a non-default post template.
The Problem
You have default pages that don’t need a template, but want to add a group of pages that have a different layout or extra blocks. But, you don’t want to go into Beaver Themer every time to you create a set of pages. When creating a basic page you want to add to a group of content, Beaver Themer adds an extra place to go.
- Difficult to see which pages are assigned to each themer layout in wp-admin
- Extra steps of going into the themer layout to select a new page
- You don’t need or want to create a custom post type for layout
The Solution
Create the Template file and make it selectable under post attributes of new pages/posts. This gives you the power of Beaver Themer to create the template, but makes it easy to change templates just like the “old days”.
Being able to select the template from within the page saves a ton of time if you have different page layouts and don’t need CPTs or don’t want to granularly control pages in Beaver Themer.
In this example, we want to create locations pages for cities the client services and add sections for maps, addresses and calls to action for SEO. We also want to remove the default map and other blocks of content in the default page footer.
Create a WordPress Page Template Designed in Beaver Themer
Step 1: Create a Singular Themer Layout in Beaver Themer.
If you want to retain the default singular template that comes with the theme, but add a new template that’s selectable from the Page Attributes section of each page/post, then in Edit Themer Layout, leave the location blank. This way, it won’t be used by another pages unless you select it from the page template field.
Save and publish this themer layout.
Step 2: Create a new template file
Name the file page_city_locations.php
. Note: Make sure the file is page_
and not page-
. page-
refers to a page slug and could cause conflicts with your website. When creating a template, WP’s standard practice to is name the file with page_
.
Step 3: Add the following code to this new template file
[pastacode lang=”php” manual=”%3C%3Fphp%0A%2F**%0ATemplate%20Name%3A%20City%20Locations%0ATemplate%20Post%20Type%3A%20page%0A*%2F%0A%0A%2F%2FSubstitute%20your%20own%20page%20ID%20in%20the%20following%20line%0AFLThemeBuilderLayoutRenderer%3A%3Arender_all(%20226%20)%3B” message=”” highlight=”” provider=”manual”/]
Step 4: Select New Template When Adding / Editing your Page
The new template now adds the template name to the WordPress page template field. You can now select your template file when adding or editing a page.
Once this is setup, changes to the Beaver Themer Layout will apply to all pages that have this template selected.
Hope this helps! Let us know if you found this useful.