Support

Account

Home Forums Add-ons Flexible Content Field 'Select' field type: not posting

Solved

'Select' field type: not posting

  • So I’m using this code to post info. based on the condition of the ‘Select’ field; but no data is posting when there is data in the fields (data.png).

    If the admin posted data using only 1 column, then post the data. If the admin posted data in two columns, then post the data using specified format (select.png).

    Field Settings
    Data

            <?php
    $title = get_field_object('title');
    $text = get_field('text');
    $texts = get_field('text_copy');
    $cols = $field['columns'][ $value ]; ?>
    <?php
    // check if the flexible content field has rows of data
    if( have_rows('text_section') ):
      while ( have_rows('text_section') ) : the_row();
        if( get_row_layout() == 'blue_content_blocks' ) {
          if(get_field('columns') == "1") { ?>
            <div>
            <?php the_sub_field('title'); ?>
            <?php the_sub_field('text'); ?>
            </div>
          <?php }      
    
        } elseif( get_row_layout() == 'blue_content_blocks' ) {
            if (get_field('columns') == "2") { ?>
           <div class="col-sm-6">
           <?php the_sub_field('title'); ?>
           <?php the_sub_field('text_copy'); ?>
           </div>
          <?php }
        }
       endwhile;
    endif;
    ?>
  • I just answered this in your other topic, don’t try and spam the same question otherwise it just dilutes the ability for people to actually help.

    https://support.advancedcustomfields.com/forums/topic/post-based-on-condition-of-field/

    Specifically in this instance however, your elseif will never fire because it is the same as your first if statement which has already run it’s code through and not had to do anything. ELSEIF statements only run if the first if statement has come back false.

  • I was trying to find the FIRST post I made and remove it so as not be flagged for ‘spamming’ since I’ve been making attempts to find the solution. But it doesn’t look like I can remove my posts.

    Thank you.

  • Don’t worry, you can always find your topics and replies if you look on your profile page 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘'Select' field type: not posting’ is closed to new replies.