Page Builder conflict with apply_filters the_content
I would show the contetn of a specific page in the sidebar. I use this code in the sidebar:
$id=123;
$p=get_page($id);
echo apply_filters('the_content', $p->post_content);This works fine in all pages, where these sidebar appear. But when i use in a page the Page Builder, then the line
echo apply_filters('the_content', $p->post_content);not show the content of the page with the id=123, but the content of the current page.
The problem is the function apply_filters, because without the filter this works:
echo $p->post_content;
Only this
echo apply_filters('the_content', $p->post_content);is a problem, and only with Page Builder. The Problem is theme indipendent. I tested with more themes also with Twentyfifteen.
This is our free support forum. Replies can take several days.
Need fast email support? Get SiteOrigin Premium
Replies
5Hi Dimizu
To avoid conflicts with both Page Builder and other plugins that use the_content to filter the post content, you should rather apply any of the specific filters you need to your sidebar content. You can find these in wp-includes/default-filters.php – line 132 to 137 in the current version of WordPress.
Hopefully that does the trick :)
Hi Dimizu
Here is a similar explanation:
http://wordpress.stackexchange.com/questions/134582/apply-filtersthe-content-content-alternative
And here is a quick mockup that might work for you:
<?php $post_id = 8159; $queried_post = get_post($post_id); $content = $queried_post->post_content; $content = apply_filters('wpautop', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?>Thanks for the feedback.
“wpauto” is exactly the solution that I’ve found in the meantime :-)
Super, really glad to hear you’ve made progress.
All the best.
This helped me resolve a conflict with Woocommerce Tabs Manager too
Replies on this thread are closed.
Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.