Hey guys, I realize this might be outside of scope for support, but I thought I’d post this anyway.
Per this post: http://forum.wpbeaverbuilder.com/support/q/best-way-to-programmatically-render-a-beaver-template-example-archives-pages/ I’ve been able to create a hard-coded template (example single.php) and insert code that renders a BB template inside that template.
Here is the code I’m using:
<?php
/*
Template Name: Example
*/
get_header(); ?>
<?php
// WP_Query arguments
$args = array (
'name' => 'masthead',
'post_type' => 'fl-builder-template',
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
echo the_content();
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
?>
<div class="container">
<div class="row">
<?php FLTheme::sidebar('left'); ?>
<div class="fl-content <?php FLTheme::content_class(); ?>">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php get_template_part('content', 'single'); ?>
<?php endwhile; endif; ?>
</div>
<?php FLTheme::sidebar('right'); ?>
</div>
</div>
<?php get_footer(); ?>
I then have the following code within functions.php (a chunk borrowed from another post in the support forums):
// Add BB css and javascript from specific post ID globally
function my_global_builder_posts($post_ids) {
$posts = get_posts(array( 'post_type' => 'fl-builder-template', 'posts_per_page' => -1 ) );
foreach($posts as $post) {
$post_ids[] = $post->ID;
}
return $post_ids;
}
add_filter('fl_builder_global_posts', 'my_global_builder_posts');
// Alter BB plugin custom post-type registration
add_action( 'init', 'bb_post_type_override' );
function bb_post_type_override() {
register_post_type( 'fl-builder-template',
array(
'public' => true,
'exclude_from_search' => false,
'label' => 'Page Builder Templates',
)
);
}
All works well, but I’ve discovered a possible CSS override that might be part of a bigger picture issue I’m not seeing. Basically, I’m unable to edit the minimum height of the Content Slider module and have that height work. So if I set the height at 800px, it stays at 400px.
If I remove the fl_builder_global_posts filter, all is well again, however my BB templates don’t render anymore.
Any ideas? Perhaps this is besides the point with a BB plugin update that should be coming out soon?
Thanks as always guys!
- Desmond