-
Notifications
You must be signed in to change notification settings - Fork 25
Setting Saved Layouts
Layouts have been refactored in 1.6. Registering and using layouts are done inside the plugin and layouts are now a post type. This page is here for historical accuracy but should not be used for creating layouts. See Deprecated Functions
There are two ways that saved layouts can be used, default layouts for a post type (or post types) and named layouts that are called directly in the theme template via the do_action
.
A saved layout can be used as a default layout for all posts of a particular post type (or multiple post types). This works similarly to the Global Layout fallback, but for all posts of a type.
In this case, the name field is just an arbitrary identifier for your own reference to distinguish it from other saved templates. A post type must be selected in the Use as Default Layout field, and the individual templates can be added or removed similarly to adding/removing template parts on individual posts/pages or in the Global Layouts.
For lack of a better word, I'm calling the other option named layouts. This means that you've given the layout a specific name and this name is used when you add the Page Builder do_action
in your theme template file. Named layouts have the benefit of not being used as the default for anything, they can be used in addition to any other saved layouts (including individual, default or global layouts), and they are only used in the places that you want (since you specifically need to call them in your template files).
In the WordPress admin, creating a named layout is identical to creating a default layout except you do not use the named layout as the default layout for any post type -- this causes the layout to not be used at all because each one is doing a Page Builder version of this:
The name field becomes more important since this is how you will identify the layout in your theme template file. Recommendations are to make the name something unique, and avoid spaces, capital letters or special characters -- anything that might make it difficult to add into a code editor.
In the example below, I've named by saved layout single-post
and the do action for this would look like this:
<?php do_action( 'wds_page_builder_load_parts', 'single-post' ); ?>
Still missing something? Let us know if you think this wiki is missing some information or could use some more details! Open an issue in the issue tracker with the information you're looking for and we'll make sure that information gets added!