add_action( 'wp_ajax_tnet_load_post_content', 'tnet_load_post_content' );
add_action( 'wp_ajax_nopriv_tnet_load_post_content', 'tnet_load_post_content' );
function tnet_load_post_content() {
$id = $_POST['pageId'];
$meta = get_post_meta( $id, 'panels_data', true );
if( class_exists( 'SiteOrigin_Panels' ) && $meta )
{
$renderer = SiteOrigin_Panels::renderer();
$content = $renderer->render( $id );
$css = $renderer->generate_css( $id );
}
else
{
$css = '';
$content = apply_filters( 'the_content', get_page($id)->post_content );
}
echo json_encode(array($content, $css));
die();
}