/** * Renders the content for a builder layout while in the loop. * This method should only be called by the_content filter as * defined in fl-builder.php. To output builder content, use * the_content function while in a WordPress loop. * * @since 1.0 * @param string $content The existing content. * @return string */ public static function render_content($content) { $post_id = FLBuilderModel::get_post_id(); $enabled = FLBuilderModel::is_builder_enabled(); $rendering = $post_id === self::$post_rendering; $ajax = defined('DOING_AJAX'); $in_loop = in_the_loop(); $is_global = in_array($post_id, FLBuilderModel::get_global_posts()); if ($enabled && !$rendering && !$ajax && ($in_loop || $is_global)) { // Set the post rendering ID. self::$post_rendering = $post_id; // Remove the builder's render_content filter so it's not called again. remove_filter('the_content', 'FLBuilder::render_content'); // Render the content. ob_start(); echo '<div class="' . self::render_content_classes() . '" data-post-id="' . $post_id . '">'; self::render_nodes(); echo '</div>'; $content = ob_get_clean(); // Reapply the builder's render_content filter. add_filter('the_content', 'FLBuilder::render_content'); // Do shortcodes here since letting the WP filter run can cause an infinite loop. $pattern = get_shortcode_regex(); $content = preg_replace_callback("/{$pattern}/s", 'FLBuilder::double_escape_shortcodes', $content); $content = do_shortcode($content); // Add srcset attrs to images with the class wp-image-<ID>. if (function_exists('wp_make_content_images_responsive')) { $content = wp_make_content_images_responsive($content); } // Clear the post rendering ID. self::$post_rendering = null; } return $content; }
/** * Renders the HTML for the post edit screen. * * @since 1.0 * @return void */ public static function render() { global $post; $post_type_obj = get_post_type_object($post->post_type); $post_type_name = strtolower($post_type_obj->labels->singular_name); $enabled = FLBuilderModel::is_builder_enabled(); include FL_BUILDER_DIR . 'includes/admin-posts.php'; }
function my_theme_show_page_header() { if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_enabled()) { $global_settings = FLBuilderModel::get_global_settings(); if (!$global_settings->show_default_heading) { return false; } } return true; }
function wma_is_active_page_builder() { //Output return apply_filters('wmhook_wmamp_' . 'wma_is_active_page_builder_output', wma_is_active_vc() || class_exists('FLBuilderModel') && FLBuilderModel::is_builder_enabled()); }
function tesseract_is_beaver_builder_page() { return class_exists('FLBuilderModel') && FLBuilderModel::is_builder_enabled(); }
/** * Renders the content for a builder layout while in the loop. * This method should only be called by the_content filter as * defined in fl-builder.php. To output builder content, use * the_content function while in a WordPress loop. * * @since 1.0 * @param string $content The existing content. * @return string */ public static function render_content($content) { global $wp_filter; $post_id = FLBuilderModel::get_post_id(); $enabled = FLBuilderModel::is_builder_enabled(); $rendering = $post_id === self::$post_rendering; $ajax = defined('DOING_AJAX'); $in_loop = in_the_loop(); $is_global = in_array($post_id, FLBuilderModel::get_global_posts()); if ($enabled && !$rendering && !$ajax && ($in_loop || $is_global)) { // Store this post ID so we know it is currently being rendered // in case another method or function calls apply filters on the // content after this method has run which creates an infinite loop. self::$post_rendering = $post_id; // Store a reference to the current the_content filters array since // any modules or widgets that call apply_filters on the_content cause // the array pointer to move to the end. That makes it so the builder // content doesn't receive filters after this method runs as it should. $filters = $wp_filter['the_content']; // Remove the builder's render_content filter so it's not called again // by modules or widgets that call apply_filters on the content. remove_filter('the_content', 'FLBuilder::render_content'); // Render the content. ob_start(); echo '<div class="fl-builder-content fl-builder-content-' . $post_id . '" data-post-id="' . $post_id . '">'; self::render_rows(); echo '</div>'; $content = ob_get_clean(); // Restore the original the_content filters array. $wp_filter['the_content'] = $filters; } return $content; }