Who is this guy?
In the beginning…
...it was a dark, dark time...
<?php wds_page_builder_load_parts(); ?>
<?php wds_page_builder_load_parts( 'my-layout-name' ); ?>function this_register_options() {
wds_register_page_builder_options( array(
'hide_options' => true, // this hides the options from the options
// page, use 'disabled' to display them as
// disabled input fields
'parts_dir' => 'parts', // where the template parts are stored
'parts_prefix' => 'part', // the template part prefix, like
// part-my-template-part.php
'use_wrap' => 'on', // on is TRUE
'container' => 'div', // the container type, can be any valid
// HTML5 element
'container_class' => 'template-part wrap', // default classes
// for the wrapper
'post_types' => array( 'post', 'page', 'car' ), // allowed post
// types
) );
}
add_action( 'init', 'this_register_options' );
function wds_setup_theme() {
add_theme_support( 'wds-simple-page-builder' );
wds_page_builder_theme_support( array(
'hide_options' => 'disabled', // set to true to hide them
// completely
'parts_dir' => 'pagebuilder', // directory the template parts
// are saved in
'parts_prefix' => 'part', // the template part prefix,
// e.g. part-template.php
'use_wrap' => 'on', // Whether to use a wrapper
// container. 'on' is TRUE
'container' => 'section', // HTML container for Page
// Builder template parts
'container_class' => 'pagebuilder-part', // can use multiple classes,
// separated by a space
'post_types' => array( 'page', ), // add any other supported post
// types here
) );
}
add_action( 'after_setup_theme', 'wds_setup_theme' );
if ( current_theme_supports( 'wds-simple-page-builder' ) ) {
// do stuff
}
add_action( 'wds_page_builder_after_load_parts', 'load_flipster' );
/**
* Function to conditionally enqueue the flipster js based on whether the
* template part is in use on the page.
* @since 0.1.0
* @return void
*/
function load_flipster() {
$parts = get_page_builder_parts();
// only load flipster on pages that use the coverflow part
if ( in_array( 'coverflow', $parts ) ) {
wp_enqueue_script( 'jquery-flipster', $this->url . '/assets/bower/
jquery-flipster/dist/jquery.flipster.min.js', array( 'jquery' ),
'20150723', true );
}
}
/** * Part Name: My Template Part Name * Description: A cool description about my part * Areas: before_content, after_content, content, hero */
This presentation was made using story|FTW. Check it out on WordPress.org:
https://wordpress.org/plugins/storyftw/
Let's go!