Separate [Advanced Custom Field] values by commas

Try to grab the output and echo together. <?php $post_objects = get_field(‘field’); if($post_objects!=”) : $value = array(); ?> <?php foreach( $post_objects as $post): ?> <?php setup_postdata($post); ?> <?php $values[] = ‘<a href=”‘. get_permalink() .'”>’. the_title(”,”,false) .'</a>’; ?> <?php endforeach; ?> <?php endif; ?> <?php wp_reset_postdata(); ?> <?php echo join( ‘, ‘, $values); ?>

use advance custom field inside query post command [closed]

When you do this: <?php query_posts(‘category_name=<?php the_field(‘cat_1_name’); ?>’,’showposts=5′); ?> The string argument is literally category_name=<?php the_field(‘cat_1_name’); ?>’,’showposts=5. Well, it would be if the string were not also triggering a fatal error. What you have is (assuming I haven’t lost track of the mess): String 1: ‘category_name=<?php the_field(‘cat_1_name’); ?>’,’showposts=5′ An undefined constant: cat_1_name An out of … Read more

ACF loop and php formatting

If it can be explicetly defined as the_title, then this should work for you: $pages = get_pages(array (‘sort_column’ => ‘menu_order’)); foreach ($pages as $page_data) { $fields = get_fields($page_data); if( $fields ) { echo ‘<div class=”the_title”>’ .$fields[‘the_title’] . ‘</div>’; echo ‘<div class=”container”>’; foreach( $fields as $field_name => $value ) { $field = get_field_object($field_name, false, array(‘load_value’ => … Read more