0

I'm new to Wordpress and PHP so not sure how to word this problem.

I'm developing a Wordpress blog with custom pages (2 column layout for the pages) and I'm using Advanced Custom Fields.

Anyways so I have a custom field called content_row which has a sub_field named row and that has 2 sub_fields named left_column and right_column.

For some reason I'm not able to pull the row content :(

My page.php code (on the first echo I'm getting a "bool(false)" on the screen):

<?php get_header(); ?>

<section style="margin-top:400px;">

<?php 
if( get_field('content_row') ): ?>

    <?php echo var_dump(has_sub_field('row')); ?>

    <?php while( has_sub_field('row') ): ?>

        <?php echo "test"; ?>

    <?php endwhile; ?>

<?php endif; ?>

</section>

<?php get_footer(); ?>

Any ideas / thoughts? Let me know if you guys need to see more code... some screenshots below: enter image description here enter image description here

1 Answer 1

0

Got it figured out!

<?php while(the_flexible_field("row")): ?>

<?php if(get_row_layout() == "2_column"): // layout: Content ?>

    <div class="content">
        <?php the_sub_field("left_column"); ?>
        <?php the_sub_field("right_column"); ?>
    </div>



    </div>

<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.