Support

Account

Home Forums ACF PRO ACF Pro template page content

Helping

ACF Pro template page content

  • 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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.