• andvines99

    (@andvines99)


    Are there shortcode that can be used like ACF had [acf field=”org_address_1″]?

    I have searched and found nothing about SCF and shortcode.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Unfortunately not, but you can create your own like that :

    function display_scf_field($atts) {
    $atts = shortcode_atts(array( 'field' => '', 'post_id' => get_the_ID(), ), $atts, 'scf');
    if (!empty($atts['field'])) {
    $value = get_field($atts['field'], $atts['post_id']);
    return $value ? esc_html($value) : '';
    }
    return '';
    }
    add_shortcode('scf', 'display_scf_field');

    And use the shortcode this way :
    [scf field="org_address_1"]

    The acf shortcode has not been removed, you can still use it with this plugin. Just remember that the shortcode needs to be enabled (it has been set to be disabled by default since ACF 6.3).

    function enable_acf_shortcode() {
    acf_update_setting( 'enable_shortcode', true );
    }
    add_action( 'acf/init', 'enable_acf_shortcode' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.