ACF get field label in custom code

Try this, which worked for me: <?php $fields = get_field_objects(); // I changed from get_fields() if( $fields ): ?> <ul> <?php // I changed $value to $field (i.e. the variable name) foreach( $fields as $name => $field ): if (stripos($name, ‘isbn’) !== false) : ?> <li><b><?php echo $field[‘label’]; ?></b> <?php echo $field[‘value’]; ?></li> <?php endif; … Read more

Query pages for use of a flexible content layout

I posted this on the ACF support forum as well and got great feedback: https://support.advancedcustomfields.com/forums/topic/query-pages-for-use-of-a-flexible-content-layout/ With a bit of tweaking, it worked. Here’s what I ended up with: <?php $flex_content_name=”flexible_content”; // < update with applicable field name $layout_name=”featured-resources”; // < update with applicable subfield name $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘page’, ‘meta_query’ … Read more