Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Using wordpress 4.4.2 and latest pagebuilder.
I’m developing widgets based on the SO Widgets Bundle framework.
In the widget templates, when I try to use get_the_excerpt(), there is some sort of html code inception (hundred of div with id=”pb-POSTID-NUMBER”) and the request times out.
example code (in a widget template):
$extrait = esc_attr(get_the_excerpt());
That line is enough to play havoc.
I realize you may need to see more code to believe me, here is the full template.
<?php $current_post_id = get_the_ID(); $term = get_term($term_id); ?> <aside class="in-this-taxonomy"> <p class="ui-title"><?php echo strtoupper($term->taxonomy) ?> <h1><a href="<?php echo get_term_link($term) ?>"><?php echo $term->name ?></a></h1> <?php if($title_image){ $img_url= category_image_src( array('size' => 'vignette-standard-carree' ,'term_id'=>$term_id) , false ); ?> <img src="<?= $img_url?>" alt="<?php echo esc_attr($term->name) ?>" > <? } // Process the post selector pseudo query. $args = array( 'tax_query' => array( array( 'taxonomy' => $term->taxonomy, 'terms' => $term_id, ), ), ); $query = new WP_Query( $args ); global $post; if($query->have_posts()) { $total = $query->post_count; ?> <ol style="counter-reset:taxonomie <?php echo ($total+1) ?>;" class="taxonomy-link-list"> <?php // Loop through the posts and do something with them. while($query->have_posts()) : $query->the_post(); setup_postdata(); $selected = ($current_post_id == get_the_ID()) ? 'class="selected"':''; ?> <li <?= $selected ?>><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( '' ); ?>" class="popup"> <?php echo replace_br_by_space(get_the_title()); // uncomment this breaks the page. //the_excerpt(); ?> </a></li> <?php endwhile; wp_reset_postdata(); } ?> </ol> </aside>Hi Alexandre,
Thanks for letting us know about this. I’ve logged this as a potential bug in our issue tracker. We’ll investigate this as soon as possible and try to come up with a fix.
Hi Alexandre,
Just an update; I’ve tried this locally and unable to replicate. Could you provide more information about the page builder? A layout export with a copy of the widget you’re building would be a huge help for us.
This is a private message.
This is a private message.
This is a private message.
here , via dropbox Private Snippet
Hi Alexandre,
Thank you for that. I’ll run a couple of tests and get back to you some time over the weekend.
I can also confirm the same issue. Caling
or
for posts using the page builder causes some sort of infinite loop and the request times out.
Yep, same here … It took me a while to realize it’s not caused by my bad templating … :)
Any hope for solution ?
I am having the same problem
Hi,
ich have the same issue on “the_excerpt” and if i want to use “$content = apply_filters( ‘the_content’, $content );”.
For the apply_filters-Problem i found a solution in your forum.
@core-team: It looks like that you use queried_object on a place you shouldn’t use it.
Every time i use “apply_filters( ‘the_content’, $content );” it processes the content of the queried-object instead of the content i provide in the filter.
Would be great if you could fix this – its pretty annoying.
I investigated the page-builder code a little.
The problem with “the_excerpt“, “get_the_excerpt” and “apply_filters( ‘the_content’, $content );” is that the global $post variable is used inside “siteorigin_panels_filter_content“.
The developers have to use it cause, the page-builder-content is not directly stored in the page-content, but in the meta-data of the post.
If you want to use “the_excerpt“, “get_the_excerpt” or “apply_filters( ‘the_content’, $content );” there are 2 Solutions.
EXAMPLE
... //the Problem --> the following line will output the content of the current global $post-object instead of 'my super fancy content' echo apply_filters( 'the_content', 'my super fancy content' ); //use of the_excerpt() will always output the excerpt of the global $post object the_excerpt(); ... ... //First Solution --> override the global $post object global $post; $post = $overrideWithNewPostObject; echo apply_filters( 'the_content', 'anyways whats written here' ); wp_reset_postdata(); ... ... //Second Solution --> disable the siteorigin filter for a moment (needs PHP7) $old_value = apply_filters('siteorigin_panels_filter_content_enabled',true);//remember old settings add_filter('siteorigin_panels_filter_content_enabled', function() { return false; }); $content = apply_filters('the_content', $post->post_content); add_filter('siteorigin_panels_filter_content_enabled', function() use ($old_value) { return $old_value; }); ...