This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

How to get several pages with Page Builder content on one page?

9 years ago · Last reply by Alex S 9 years ago

Hello,
Thank you, Page Builder is really awesome!

For my custom theme I need to show all pages on frontpage in some order. Also I need to filter page content to convert short code to real HTML. My code (bellow) is working fine with default WP editor, but don’t show anything with Page Builder content (actually any PB page is showing as it’s last state from the default editor).

How to properly show Page Builder pages in custom query?

Here is my code (simplified):

global $page;
$args = array(
	'sort_order' => 'ASC',
	'sort_column' => 'menu_order, ID, post_title',
	'hierarchical' => 1,
	'exclude' => '',
	'include' => '',
	'meta_key' => '',
	'meta_value' => '',
	'authors' => '',
	'child_of' => 0,
	'parent' => -1,
	'exclude_tree' => '',
	'number' => '',
	'offset' => 0,
	'post_type' => 'page',
	'post_status' => 'publish'
); 
$pages = get_pages($args);
foreach( $pages as $page ) {
	$content = $page->post_content;
	$content = apply_filters( 'the_content', $content );
	?>
	<div class="section <?php echo $page->post_name; ?>">
		<div class="entry"><?php echo $content;?></div>
	</div>
	<?php
} 
wp_reset_postdata();

I found theres similar topics, but unfortunately without straight answers:

Page Builder conflict with apply_filters the_content

Page builder not outputting anything

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Alex S Staff 9 years, 11 months ago

    Hi Vovkasolovev,

    I’m actually not sure how to query it directly as I can’t work it out either. :S I’ve forwarded your thread onto the development team to hopefully find an answer.

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.

Have a different question or issue?

Start New Thread