Support

Account

Home Forums General Issues Loop issue with checkbox Reply To: Loop issue with checkbox

  • Hi,

    in your example you’re checking the whole array of “featured”. Well, you’re already in the loop, so you’re already just working with a single post – and that post can either have the “featured” field on or off.

    If you have the ‘featured’ field as a boolean (true/false), you can just edit your IF line to this:

    <?php if(get_field('featured')) { ?>

    And if you’re setting this field to something custom, just check it against that value:

    <?php if(get_field('featured') == 'custom_value') { ?>

    … ad as far as getting only one post (last) – fix your query, you can set “posts_per_page” to -1 to include all of the featured posts.