Support

Account

Home Forums General Issues Displaying acf values in Elementor using HTML Reply To: Displaying acf values in Elementor using HTML

  • // Add Shortcode to display ACF field value for the scrolling marquee
    function marquee_text_shortcode() {
    // Get the ID of the current page being viewed
    $post_id = get_the_ID();

    // Get the ACF field value for THAT specific page/post
    $marquee_text = get_field(‘marquee_txt’, $post_id);

    // Check if the field has content and return it
    if ( $marquee_text ) {
    // We use esc_html() to make sure the output is secure
    return esc_html($marquee_text);
    }

    // Optional: Return a default message if the field is empty
    return ‘See calendar for details ✦’;
    }
    add_shortcode( ‘scroll_txt’, ‘marquee_text_shortcode’ );