WooRockets / WR-PageBuilder

PageBuilder for Wordpress from woorockets.com
34 stars 31 forks source link

Shortcodes not evaluated properly if template_tags are used within wr_widget #5

Open pierrebeitz opened 9 years ago

pierrebeitz commented 9 years ago

Hi there!

Whenever i try to add a WP_Widget which renders Posts, using the_content or the_excerpt, only the shortcode (wr_widget) of this widget is evaluated. The outer structure, including all wr_rows and wr_columns is not evaluated and displayed as plain text on the page.

one simple way to reproduce this, is to add a simple <?php the_excerpt() ?> in the WP_Widget_Recent_Posts (approx line 717) in default-widgets.php and add it to a wr-pagebuilder-layout.

it should read like this:

...
  <ul>
    <?php while ( $r->have_posts() ) : $r->the_post(); ?>
      <?php the_excerpt(); // <------ INSERT TO BREAK! ?>
      <li>
        <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
...

most template-tags seem to be fine. anything utilizing the_content seems to break. my best guess yet would be the order of the filters registered on the_content. some context worth looking at seems to be in the pagebuilders core/core.php stating:

                // remove placeholder text which was inserted to &lt; and &gt;
                $wr_pagebuilder_content = WR_Pb_Utils_Placeholder::remove_placeholder( $wr_pagebuilder_content, 'wrapper_append', '' );

                $wr_pagebuilder_content = preg_replace_callback(
                        '/\[wr_widget\s+([A-Za-z0-9_-]+=\"[^"\']*\"\s*)*\s*\](.*)\[\/wr_widget\]/Us', array( 'WR_Pb_Helper_Shortcode', 'widget_content' ), $wr_pagebuilder_content
                );

do you have any idea what is causing this?