Support

Account

Home Forums Add-ons Flexible Content Field Each field is displayed in different div

Helping

Each field is displayed in different div

  • <?php if( have_rows('main_content_block') ): 
        while ( have_rows('main_content_block') ) : the_row();
        if( get_row_layout() == 'full_block' ):				
    ?>
        <div class="row primary-block">
            <div class="col-md-12">
                <h1><?php the_sub_field('main_title'); ?></h1>
                <?php the_sub_field('main_content'); ?>
            </div>
        </div>
    <?php endif; endwhile; ?>
    <?php endif; ?>

    Both sub fields are being displayed in different set of DIVs (“row primary-block” and “col-md-12”), According to login whole block of code should be displayed at once.

    <div class="row primary-block">
        <div class="col-md-12">
            <h1>Duis Mollis est Non Commodo Kuctus Nisierat</h1>
            <div class="row primary-block">
                <div class="container">
                    <p>Maecenas sed diam eget risus varius blandit sit amet non magna. Sed posuere consectetur est at lobortis. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
    </div>
    </div>

    You can notice two extra DIVs starting after H1 in above code. This is the output i am getting.

  • Check the content in the sub field ‘main_content’

    The extra div elements being output is happening here

    
    <?php the_sub_field('main_content'); ?>
    

    so those div elements must be in the wysiwyg editor. This can happen when copying content from a web page and pasting it directly into a WP WYSIWYG editor.

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

The topic ‘Each field is displayed in different div’ is closed to new replies.