[ Web Proxy ]
URL:
Viewing: https://www.acf-extended.com/features/fields/dynamic-render [Back]  [Original]

ACF Dynamic Render Field – ACF Extended

Dynamic Render FREE

Docs Fields Dynamic Render

#Field Render

Display a custom PHP/HTML output using a simple named hook.

Field Group
Dynamic Message

Curabitur aliquet quam id dui posuere blandit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.

CompanyContactCountry
Island TradingHelen BennettUK
Ernest HandelRoland MendelAustria
Alfreds FutterkisteMaria AndersGermany

#Field Value

The value cannot be retrieved as the field isnt saved as meta data.

#Field Content

#Render Field Hook

You can render any custom content using the native acf/render_field hook. Usage example:

<?php
/**
 * https://www.advancedcustomfields.com/resources/acf-render_field/
 */
add_action('acf/render_field/name=my_field', 'my_acfe_dynamic_render');
function my_acfe_dynamic_render($field){
    ?>
    
    <table class="wp-list-table widefat fixed striped">
      <tr>
        <td>Island Trading</td>
        <td>Helen Bennett</td>
        <td>UK</td>
      </tr>
    </table>
    
    <?php
}

#Inline Render Callback

It is possible to render custom content directly within the field declaration when using local PHP field registration. Usage example:

<?php
acf_add_local_field_group(array(
    'key' => 'group_my_field_group',
    'title' => 'My Field Group',
    'fields' => array(
        array(
            'key'       => 'field_my_dynamic_render',
            'label'     => 'My Dynamic Render',
            'name'      => 'my_dynamic_render',
            'type'      => 'acfe_dynamic_render',
            
            // Inline render callback
            'render'    => function($field){
                ?>
                <table class="wp-list-table widefat fixed striped">
                    <tr>
                        <td>Island Trading</td>
                        <td>Helen Bennett</td>
                        <td>UK</td>
                    </tr>
                </table>
                <?php
            }
        ),
    ),
    'active' => true,
    'location' => array(
        array(
            array(
                'param' => 'post_type',
                'operator' => '==',
                'value' => 'post',
            ),
        ),
    ),
));

EXTENDED

2019 - 2026. ACF is a Delicious Brains Inc brand.

ACF Extended is not affiliated or endorsed by Delicious Brains.


Web Proxy Viewer  |  New URL  |  Original Page