• torbent

    (@torbentschechnegmailcom)


    I installed the ACF Plugin for WordPress and I use OWL Carousel for WP in my installation. I want to enable the user to use the shortcode OWL carousel provides within ACF.

    In my template file I do:

    <div class="slider">
        <?php
        $slider = get_field('stadium_slider');
        echo do_shortcode( $slider );
        ?>
    </div>
    <div class="stadium-text-footer">
    <?php the_field('stadium_footer_text'); ?>
    
    <?php the_field('stadium_link'); ?>
    </div>

    The problem I know face is, that the shortcode is taken into consideration and the output is good – however the next div stadium-text-footer is empty. When i remove the do_shortcode from the template, the footer text and the link are being displayed.

    Does anybody know what’s wrong here and how I can solve it?

    Thanks!

    https://wordpress.org/plugins/advanced-custom-fields/

Viewing 1 replies (of 1 total)
  • Remember that with acf you are pulling in the field to your template, not pulling in the shortcode.
    The shortcode does it’s own work to load the data into the field, then you are pulling in the field itself, containing this data so this should work ok with <?php the_field(‘stadium_slider’); ?> which will display what’s in that field.

    Alternatively, manually create the slider code within your template and use a repeater acf field
    Hope this helps

Viewing 1 replies (of 1 total)

The topic ‘ACF Plugin – Using shortcodes in text fields’ is closed to new replies.