Hello,
We are having a private page that use a custom template and render soem acf fields for the content. We need to create an api call that will get just the HTML content that the page template is rendering (HTML and data).
We are using that part of code to achieve this, but we don’t know if there is a better way to render the content.
global $post;
$post = get_page_by_path(‘page-slug’);
setup_postdata( $post );
$cc = get_template_part( ‘template-page’ );
wp_reset_postdata();
Looks like a good way to do it to me.