Home Forums Front-end Issues Strange Flexible Content and Custom Shortcode Behavior


Strange Flexible Content and Custom Shortcode Behavior

  • Hi everyone,

    The issues I am having are somewhat specific to my application, but here goes.

    I am using ACF to generate flexible content fields that will allow a person to choose between one and two page column layouts on a page. I have also created a custom shortcode to display data that is stored in an ACF Options Page field.

    When I add the custom shortcode to my one column layout, get_row_layout returns false.

    Here is my code:

    shortcode in functions.php

    add_shortcode('map', 'map_func');
    function map_func() {
      if(have_rows('contact_method', 'options')) {
        $values = get_field_object('contact_method', 'options')['value'];
        foreach($values as $value) {
          if($value['acf_fc_layout'] === 'address') {
            $query = rawurlencode($value['contact_method_field']);
            $src = '' . $query . '&key=XXXXXXXXXXXXXXXXXXXXXX';
            <iframe width="600" height="450" frameborder="0" style="border:0" src="<?php echo $src; ?>" allowfullscreen></iframe>
          <?php }
      $html = ob_get_contents();
      return $html;


    if(get_row_layout() === 'one') { // returns false with custom shortcode added
                    echo $body;
    if(get_row_layout() === 'two') { ?>
                        <div <?php echo $style_att_left; ?> class="col-md-6">
                          <?php the_sub_field('content_section_body_left'); ?>
                        <div <?php echo $style_att_right; ?> class="col-md-6">
                          <?php the_sub_field('content_section_body_right'); ?>
                      <?php }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.