-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
41 lines (35 loc) · 1.07 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Integration with Beaver Builder
*/
if ( ! class_exists( 'FLBuilder' ) ) return;
require_once __DIR__ . '/field-types/index.php';
require_once __DIR__ . '/modules/index.php';
require_once __DIR__ . '/enqueue.php';
/**
* Let template system know when rendering preview inside builder
*
* @see /system/integrations/index.php
* @see bb-plugin/classes/class-fl-builder-model.php
*/
add_action('wp', function() use ( $plugin ) {
$plugin->set_template_preview_state(
FLBuilderModel::is_builder_active()
);
});
/**
* Disallow default loop context (global $wp_query) for Beaver template and layout,
* as well as the current post being rendered in the page builder.
*
* This prevents infinite loop for Loop tag without "type" attribute.
*
* @see vendor/tangible/loop/context/index.php
* @see bb-plugin/classes/class-fl-builder.php, render_content()
*/
add_filter('tangible_loop_default_context_allowed', function( $allowed, $post_type, $post ) {
return $allowed
&& ! in_array($post_type, [
'fl-builder-template',
'fl-theme-layout',
]);
}, 10, 3);