示例#1
0
/**
 * Initiate the admin side to show the sections
 */
function acfpg_init_admin()
{
    if (!is_admin()) {
        return false;
    }
    $pb = new ACF_Page_Builder();
    add_action('wp_enqueue_script', array($pb, 'enqueueAdmin'));
    $pb->addFieldsToWP();
}
示例#2
0
/**
 * Get all the sections HTML to output to the page
 * @param  String $id  This post or page's ID
 * @return String      The final HTML for the page
 */
function get_sections($id = '')
{
    global $post;
    if (!$id && isset($post)) {
        $id = $post->ID;
    }
    if (!$id) {
        return false;
    }
    $pb = new ACF_Page_Builder();
    $pb->addFieldsToWP();
    $html = $pb->getSectionsHTML('acf_page_builder', (string) $id);
    return isset($html) ? $html : '';
}