Support

Account

Home Forums General Issues ACF fields in custom metabox / pages, …

Helping

ACF fields in custom metabox / pages, …

  • Hi,

    Is it possible through PHP to add ACF fields to a custom metabox, a settings page or another location?

    Now I always use:

    if( function_exists(‘acf_add_local_field_group’) ):
    $prefix = ‘prefix_’;
    acf_add_local_field_group(array(
    ‘key’ => ‘group_’ . substr($prefix, 0, -1),
    ‘title’ => __( ‘Field Group Name’ , ‘textdomain’ ),
    ‘fields’ => array(
    // Start Adding fields
    // Here …
    // End Adding Fields
    ),
    ‘location’ => array(
    array(
    array(
    ‘param’ => ‘post_type’,
    ‘operator’ => ‘==’,
    ‘value’ => ‘page’,
    ),
    ),
    array(
    array(
    ‘param’ => ‘post_type’,
    ‘operator’ => ‘==’,
    ‘value’ => ‘post’,
    ),
    ),
    ),
    ‘menu_order’ => 0,
    ‘position’ => ‘normal’,
    ‘style’ => ‘default’,
    ‘label_placement’ => ‘top’,
    ‘instruction_placement’ => ‘label’,
    ‘hide_on_screen’ => ”,
    ‘active’ => 1,
    ‘description’ => ”,
    ));
    endif;

    to add a metabox but I would like to go a step further as I need to style the metabox more in detail with extra features but I would like to keep the power of ACF all the fields settings.

    Is this possible?

  • ACF has options pages https://www.advancedcustomfields.com/resources/options-page/

    ACF does not have the ability to add fields to pages created in WP using it’s functions to add admin pages, for example add_options_page() https://codex.wordpress.org/Function_Reference/add_options_page or any of the related functions listed at the bottom of this document.

    Styling of ACF can be accomplished by adding custom CSS, there is a short explanation of that here https://www.wpguru.com.au/wordpress-development-tips/add-custom-css-js-advanced-custom-fields-plugin/

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

The topic ‘ACF fields in custom metabox / pages, …’ is closed to new replies.