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.
$post = get_page_by_path(‘page-slug’);
setup_postdata( $post );
$cc = get_template_part( ‘template-page’ );
Looks like a good way to do it to me.