Home>Support>SiteOrigin Page Builder and the Posts Page | Theme Development

SiteOrigin Page Builder and the Posts Page | Theme Development

I’m creating a theme for WordPress. On the Posts Page I would like there to be opening content, and I would like to style this content with Page Builder.

In the past, what I’ve done is re-enable the posts editor for the Posts Page with the following code:

function editor_on_posts_page( $post ) {
    if ( $post->ID != get_option( 'page_for_posts' ) ) {
        return;
    }

    remove_action( 'edit_form_after_title', '_wp_posts_page_notice' );
    add_post_type_support( 'page', 'editor' );
}
add_action( 'edit_form_after_title', 'editor_on_posts_page', 0 );

Afterwards, I can add the content by implementing the following:

blog_page = get_post( get_option( 'page_for_posts' ) );
if ( $blog_page->post_content ) {
	setup_postdata( $blog_page );
	the_content();
	wp_reset_postdata( $blog_page );
}

The post outputs as expected. However, when the page is built using Page Builder the content outputs but the styling used within Page Builder is not.

After further investigation it appears that several items are not being included onto the page, including external style sheets, embedded style sheets, body tag classes, and javascript. The entire panel-layout html is being included, though unstyled.

What steps are required for me to have these key aspects work. It should be noted that the account I’m working with does have “SiteOrigin Premium” so I am able to implement any steps specific to this plugin.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 5 years, 11 months ago Alex S
    Hi, I Work Here

    Hi Jchute,

    I’m not too sure why this is happening, but I suspect it may be due to how you’re fetching the post. I would personally recommend directly outputting SiteOrigin Page Builder in this situation. This would look something like this:

    if ( class_exists( 'SiteOrigin_Panels' ) && get_post_meta( $blog_page->ID, 'panels_data', true ) ) {	echo SiteOrigin_Panels::renderer()->render( $blog_page->ID  );} else {	echo apply_filters( 'the_content', $blog_page->post_content );}

    Alternatively, the following should also work:

    echo apply_filters( 'the_content', $blog_page->post_content );

    The above PHP will check if SiteOrigin Page Builder is activated and if it is, check if the post has SiteOrigin Page Builder enabled. If it does, it’ll output it. If it doesn’t, it’ll run the_content();

    By the way, as you’re a premium user, you’re entitled to priority email support. If you would like to make use of that, please follow the instructions found on your Page: Dashboard (please refer to the support tab). Please reference this thread and include your SiteOrigin Premium License in your email.

  2. 5 years, 11 months ago jchute

    Thank you, Alex! Your first code worked perfectly.

    I believe you had one minor mistake, where on the fourth line the content should be echo’d after being filtered, but the rest worked exactly as it needed to! Thanks for all the help!

    Also, the blogs I’m working on have SiteOrigin Premium, however, our lead has purchased the package and I do not have access to that account. Thanks for your help anyway!

  3. 5 years, 11 months ago Alex S
    Hi, I Work Here

    Hi Jchute,

    Great to hear! :)
    Oh! Sorry, yes, you’re right – that line does need an echo.

    Also, the blogs I’m working on have SiteOrigin Premium, however, our lead has purchased the package and I do not have access to that account. Thanks for your help anyway!
    If they provide you with a copy of the premium key, you’ll be able to email premium support at Private Snippet. You don’t require access to the relevant account.

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.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More