0

I'm building a onepage website, using the Pootle Page Building plugin. With get_page, I show every separate page on 1 page. To target the Pootle Page Builder content, I'm using the following code:

$content = $GLOBALS['Pootle_Page_Builder_Render_Layout']->panels_render( $page_data->ID );

When I try to implement a plugin like a carousel, where I need to use a shortcode, the shortcode doens't work.

For the shortcode to work, I need to use

apply_filters('the_content', $page_data->post_content);

Except, instead of 'the_content' I use:

$content = $GLOBALS['Pootle_Page_Builder_Render_Layout']->panels_render( $page_data->ID );

Does anyone perhaps know how I can add apply_filters to $GLOBALS['whatever'] so the shortcodes will work

0

Assuming that $GLOBALS['Pootle_Page_Builder_Render_Layout'] carries an instance of Pootle_Page_Builder_Render_Layout, the method panels_render() returns a string.

So you can simply pass the method call as an argument to apply_filters():

$content = apply_filters( 'the_content', $GLOBALS['Pootle_Page_Builder_Render_Layout']->panels_render( $page_data->ID ) );

I'm not sure whether this is an intended use of the API of the plugin, as Pootle_Page_Builder_Render_Layout::panels_render() remove some default filters from the content (wptexturize, wpautop and convert_chars). So maybe your concern is also worth a question on the plugin support forum.

  • Thanks for your response David! I tried it, but sadly the shortcodes still don't work. I also tried to activate the plugins manually in the page.php, like this: echo "<div class='content'>"; echo "<h2>$title</h2>"; echo $content; if (is_page( 83 )) { echo do_shortcode('[wds id="1"]'); } if ( is_page( 109 ) ) { echo do_shortcode('[formidable id="2"]'); } echo "</div>"; This time, the plugins DO show, but sadly they show on every single page on the onepage website, although I only target the pages 83 and 109. Maybe this is an easier fix? Many Thanks. – MartinU Aug 11 '15 at 10:27
  • Your question was, how to use apply_filters() on the returning value of the page builder object. Please don't write code in comment but update your question. – David Aug 11 '15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.