Title: Comma separator
Last modified: September 12, 2020

---

# Comma separator

 *  [simoneboccuzzi](https://wordpress.org/support/users/simoneboccuzzi/)
 * (@simoneboccuzzi)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/comma-separator/)
 * Hello!
    I would like my list of articles to be separated by commas and not bulleted
   list. I use the code snippet plugin to insert the php code. How can I solve?
 * Screen:
    [https://share.getcloudapp.com/2NuyZK0K](https://share.getcloudapp.com/2NuyZK0K)
   [https://share.getcloudapp.com/Z4uk8xqY](https://share.getcloudapp.com/Z4uk8xqY)
 * Thank you!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcomma-separator%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Frederik Rosendahl-Kaa](https://wordpress.org/support/users/frederik-rosendahl-kaa/)
 * (@frederik-rosendahl-kaa)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/comma-separator/#post-13402986)
 * Hi [@simoneboccuzzi](https://wordpress.org/support/users/simoneboccuzzi/),
 * To change the way relationship field output is displayed on then you have to 
   add some code in your function.php in your theme or child-theme.
 * I do not really know anything about the code snippet plugin so do not know if
   you can insert the code here as well.
 * But I have made some code as you can see here which makes the relationship field
   a comma seperate list
 *     ```
       add_filter( 'acfvc_relationship', 'acfvc_custom_relationship', 10, 3 );
       function acfvc_custom_relationship ( $output, $field, $post_id ) {
       	$posts = $field["value"];
       	$output = "<div>";
       	foreach($posts as $key => $post_details) {
       		$post_id = $post_details->ID;
   
       		$output .= '<a href="'.get_permalink($post_id).'" title="'.get_the_title($post_id).'">'.get_the_title($post_id).'</a>';
   
       		if ( $key != array_key_last( $posts ) ) {
       			$output .= ', ';
       		}
       	}
       	$output .= "</div>";
   
       	return $output;
   
       }
       ```
   
 * Hope it can help you, otherwise feel free to write again.
 * Best regards
    Frederik
 *  Thread Starter [simoneboccuzzi](https://wordpress.org/support/users/simoneboccuzzi/)
 * (@simoneboccuzzi)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/comma-separator/#post-13408634)
 * Thank you so much for your help, your time and your quick response.
    Unfortunately
   the code doesn’t work. I hope you can help me again. I attach a screenshot of
   what happens. Thank you!
 * Screen
    [https://share.getcloudapp.com/d5uEqXPY](https://share.getcloudapp.com/d5uEqXPY)
 * I would like something like this:
    [https://share.getcloudapp.com/jkuZGpXX](https://share.getcloudapp.com/jkuZGpXX)
    -  This reply was modified 5 years, 8 months ago by [simoneboccuzzi](https://wordpress.org/support/users/simoneboccuzzi/).
 *  Plugin Author [Frederik Rosendahl-Kaa](https://wordpress.org/support/users/frederik-rosendahl-kaa/)
 * (@frederik-rosendahl-kaa)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/comma-separator/#post-13429790)
 * HI [@simoneboccuzzi](https://wordpress.org/support/users/simoneboccuzzi/),
 * I just changed the code a bit so it should work.
    If it does not then I do not
   quite know what I can do as both codes I have sent work on my development environment.
 *     ```
       add_filter( 'acfvc_relationship', 'acfvc_custom_relationship', 10, 3 );
       function acfvc_custom_relationship ( $output, $field, $post_id ) {
       	$posts = $field["value"];
       	$output = "<div>";
   
       	$count = count( $posts );
       	$i = 1;
   
       	foreach($posts as $key => $post_details) {
       		$post_id = $post_details->ID;
   
       		$output .= '<a href="'.get_permalink($post_id).'" title="'.get_the_title($post_id).'">'.get_the_title($post_id).'</a>';
   
       		if ( $i < $count ) {
       			$output .= ', ';
       		}
       		$i++;
       	}
       	$output .= "</div>";
   
       	return $output;
   
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Comma separator’ is closed to new replies.

 * ![](https://ps.w.org/acf-vc-integrator/assets/icon-128x128.png?rev=1450656)
 * [ACF-VC Integrator](https://wordpress.org/plugins/acf-vc-integrator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-vc-integrator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-vc-integrator/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-vc-integrator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-vc-integrator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-vc-integrator/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Frederik Rosendahl-Kaa](https://wordpress.org/support/users/frederik-rosendahl-kaa/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/comma-separator/#post-13429790)
 * Status: not resolved