Support

Account

Home Forums ACF PRO True-false checkbox field doesn't display in front end

Helping

True-false checkbox field doesn't display in front end

  • What I’m trying to do is query and display posts that have the T/F checkbox ticked, but this code isn’t working:

    ‘<?php
    $posts = get_posts(array(
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘feature_in_blue_box’,
    ‘compare’ => ‘=’,
    ‘value’ => ‘1’
    )
    )
    ));

    if( $posts ): ?>

      <?php foreach( $posts as $post ): setup_postdata( $post ) ?>

    • <?php the_content(); ?>
    • <?php endforeach; ?>

    <?php wp_reset_postdata();

    endif; ?>’

    Nothing displays on the front end. When I did the debug data from the $posts variable as directed by Support, it showed NULL. Any help greatly appreciated!

  • Sorry, it didn’t show my ul and li tags in the above snippet around the_content but you get the idea. All that is in there.

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

You must be logged in to reply to this topic.