Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Custom Field URL and Target

Provide URL address and target for many post types

if(function_exists("register_field_group"))
{
    register_field_group(array (
        'id' => 'acf_link',
        'title' => 'Link',
        'fields' => array (
            array (
                'key' => 'field_551feef53b9ac',
                'label' => 'URL Link',
                'name' => 'url-link',
                'type' => 'text',
                'instructions' => 'Provide the URL addres (http://www...)',
                'default_value' => '',
                'placeholder' => 'http://...',
                'prepend' => '',
                'append' => '',
                'formatting' => 'none',
                'maxlength' => '',
            ),
            array (
                'key' => 'field_551fef703b9ad',
                'label' => 'URL Target',
                'name' => 'url-target',
                'type' => 'text',
                'instructions' => 'Provide the page target to link (_self, _parent, _new)',
                'default_value' => '_self',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'formatting' => 'none',
                'maxlength' => 10,
            ),
        ),
        'location' => array (
            array (
                array (
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'bloco',
                    'order_no' => 0,
                    'group_no' => 0,
                ),
            ),
        ),
        'options' => array (
            'position' => 'normal',
            'layout' => 'default',
            'hide_on_screen' => array (
            ),
        ),
        'menu_order' => 0,
    ));
}