RPeraltaJr
1/16/2020 - 7:08 PM

LP Settings Post Type and ACF from a Post Type Page

<?php 

// * Adds in post type for site settings, LP settings
function create_posttypes()
{
    // $options = array(
    //     'label' => 'Site Settings',
    //     'public' => false,
    //     'publicly_queryable' => true,
    //     'show_ui' => true,
    //     'menu_icon' => 'dashicons-media-document',
    //     'has_archive' => true,
    //     'supports' => array('title', 'thumbnail', 'revisions'),
    // );
    // register_post_type('site_settings', $options);

    $options = array(
        'label' => 'LP Settings',
        'public' => false,
        'publicly_queryable' => true,
        'exclude_from_search' => true,
        'show_ui' => true,
        'menu_icon' => 'dashicons-media-document',
        'has_archive' => true,
        'supports' => array('title', 'thumbnail', 'revisions'),
        'taxonomies' => array('category', 'post_tag')
    );
    register_post_type('lp_settings', $options);
}
// hook
add_action('init', 'create_posttypes');
flush_rewrite_rules( false );
<?php 

// form settings ...

// advanced custom fields
$master_copy_id = 47;
$global_copy = get_field('override_global_copy');
if($global_copy):
    $master_copy_id = $global_copy->ID;
endif;

// components ...
<?php 

// advanced custom fields
$hero = get_field('hero', $master_copy_id);
$hero = (object) $hero;

// Html below...