Beispiel #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();
}
Beispiel #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 : '';
}
 /**
  * Return an instance of this class. Singleton pattern.
  *
  * @since     0.1.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }