using FLBuilder::render_content

Hi,

I am creating a WooCommerce template and it should display the page content.

Obviously, Beaver pages are not normal content, the content is retrieved from alternative database table as a logical data-tree and translated into elements.

I digged into Beaver code and saw the FLBuilder::render_content.
I also realized that you have a filter, add_filter(‘the_content’, ‘FLBuilder::render_content’);

  1. How do I render the content in Beaver way? what params does render_content expect?
  2. Out of curiosity, while being in the template, I am in the WP loop (correct?), then why when I call the_content() function the filter hook is not called?

See part of my single-product-content.php code:

<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>">

	<h1>BEAVER CONTENT</h1>
	<?php FLBuilder::render_content(get_the_content()); // the_content(); ?>

	<meta itemprop="url" content="<?php the_permalink(); ?>" />

</div><!-- #product-<?php the_ID(); ?> -->

<?php do_action( 'woocommerce_after_single_product' ); ?>

Thanks.

Had to do echo FLBuilder::render_content(get_the_content();

Still, it would be great if you add FLBuilder::render_content($post_id) or so.
Currently, I am using an ugly trick by overriding the global $post parameter:

global $post;
 $post = get_post( $product_template_page_id );

Hi Elemento,

You may get unexpected results from that method as it’s intended to run as a callback for “the_content” filter. Is simply calling the_content(); not working for you?

Let me know.

Justin

You are right, it is better that I use the_content and rely on the filter.

However, I get unexpected results.
The frontend.css.php (and probably js.php) are not loaded.

Any idea?

What module is not having its CSS/JS loaded? Or do you mean POST_ID-layout.css?

Exactly. The POST_ID_layout.css is not loaded when calling the_content().

Is this post coming from a custom/secondary loop? Or is it in the main loop?

Main I guess. The code below prints page content (see conditional statement).


<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>">

	<?php if ( is_main_query() ) {
		 echo the_content(); 
	} ?>

	<meta itemprop="url" content="<?php the_permalink(); ?>" />

</div><!-- #product-<?php the_ID(); ?> -->

<?php do_action( 'woocommerce_after_single_product' ); ?>

I added prints to FLBuilder::render_content and FLBuilder::render_module_css. The code never reaches the second one.

    static public function render_module_css($type, $id, $settings)
    {
        CustomBuilderHelper::log("render_module_css");

        $global_settings = FLBuilderModel::get_global_settings();
        $defaults = FLBuilderModel::get_module_defaults($type);

Can you email me a copy of your theme? Justin [at] fastlinemedia [dot] com.

Let me know what file this is.

Thanks!
Justin

It is a bit complicated one, it is a plugin not a theme that relies on WooCommerce and existing theme.

I will make it simpler, straightforward and send it asap. Or even upload it to a test server so you can login.

Thanks =)