Advanced LinkFREE

Docs Fields Advanced Link

#Field Render

Display a modern Link Selector in a modal which allow customization. Posts, Post Types Archives & terms selection can be filtered in the field administration.

Field Group

#Field Settings

Setting nameDescription
Filter by Post TypeFilter which Post Types are allowed
Filter by TaxonomyFilter which Taxonomies are allowed

#Field Value

#Formatted Value

$advanced_link = get_field('advanced_link');

/**
 * array(
 *     'type'   => 'post',
 *     'value'  => 3596,
 *     'url'    => 'https://www.acf-extended.com/my-post',
 *     'name'   => 'My Post',
 *     'title'  => 'Text Link',
 *     'target' => '_blank',
 * )
 */

#Unformatted Value

$advanced_link = get_field('advanced_link', false, false);

/**
 * array(
 *     'type'   => 'post',
 *     'value'  => 3596,
 *     'title'  => 'Text Link',
 *     'target' => true,
 * )
 */

#Add Sub Fields

You can add your own sub fields using acfe/fields/advanced_link/sub_fields hook. All ACF fields are compatible, as long as they are correctly registered. Usage example:

/**
 * acfe/fields/advanced_link/sub_fields
 * 
 * @array  $sub_fields  Array of sub fields to add
 * @array  $field       Advanced Link field configuration
 * @array  $value       Field values
 */
 
filter('acfe/fields/advanced_link/sub_fields',                         $sub_fields, $field, $value);
filter('acfe/fields/advanced_link/sub_fields/name=my_advanced_link',   $sub_fields, $field, $value);
filter('acfe/fields/advanced_link/sub_fields/key=field_5ff278331b101', $sub_fields, $field, $value);
add_filter('acfe/fields/advanced_link/sub_fields/name=my_advanced_link', 'my_acf_advanced_link_sub_fields', 10, 3);
function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
    
    $sub_fields[] = array(
        'name'      => 'my_field',
        'key'       => 'my_field',
        'label'     => 'My field',
        'type'      => 'true_false',
        'ui'        => true
    );
    
    return $sub_fields;
    
}