开发者 |
jazzs3quence
webdevstudios |
---|---|
更新时间 | 2016年6月7日 02:54 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 4.2.2 |
do_action
wherever you want the template parts to load:
<?php do_action( 'wds_page_builder_load_parts' ); ?>
This will take care of loading the correct template parts in the order you specified. You can also specify a specific saved layout by passing the layout name to the do_action
as a second parameter, like this:
<?php do_action( 'wds_page_builder_load_parts', 'my-saved-layout' ); ?>
Note: With saved layouts, the name you pass to the do_action must match exactly the way it is saved on the options page. So, if your layout was instead named "my saved layout", you would need to pass it to the do_action
with the spaces intact.
Page vs Global Parts vs Saved Layouts
The page builder will, by default, use the template parts that were set on the page when you set them on the Edit page screen. However, if no template parts were defined on the individual page, you can also set Global Template Parts that will load on all pages that don't have their own, individual template parts defined.
You can leave the Global setting to "- No Template Parts -" to not define any global template parts if individual page-specific template parts weren't set.
Saved layouts are used when there is no layout set for that page (or post) with Global layouts used as a generic fallback. You can set a saved layout to be the default layout for all posts of a type or you can call them specifically when you add the do_action
to your theme template files.
Pluginize was launched in 2016 by WebDevStudios to promote, support, and house all of their WordPress products. Pluginize is not only creating new products for WordPress all the time, but also provides ongoing support and development for WordPress community favorites like CPTUI, CMB2, and more.
wds-simple-page-builder
directory to the `/wp-content/plugins/` directory or install via the Plugin Installer<?php do_action( 'wds_page_builder_load_parts' ); ?>
in your templatespage_builder_class
function (issue | documentation)add_theme_support( 'wds-simple-page-builder' )
) and a helper function to initialize the Page Builder options (documentation)saved_page_builder_layout_exists
functionwds_template_part_prefix
and wds_template_parts_dir
and replaced them with wds_page_builder_template_part_prefix
and wds_page_builder_template_parts_dir
, respectivelyunregister_page_builder_layout
to unregister a single registered layout (or all of them if 'all'
is passed)wds_page_builder_load_parts
for loading an array of specific template parts and wds_page_builder_load_part
for loading a single template partdo_action
, e.g. do_action( 'wds_page_builder_load_parts', 'my named layout' )