Title: [Plugin: Posts 2 Posts] Displaying connected posts as comma separated list
Last modified: August 21, 2016

---

# [Plugin: Posts 2 Posts] Displaying connected posts as comma separated list

 *  [anthonydoes](https://wordpress.org/support/users/anthonydoes/)
 * (@anthonydoes)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/plugin-posts-2-posts-displaying-connected-posts-as-comma-separated-list/)
 * This is probably a noob questions, but I’m using the Posts 2 Posts plugin. I’m
   trying to display the connected posts as a comma separated list, instead of an
   unordered, bulleted list.
 * Here is the code I began with:
 *     ```
       <?php
       // Find connected pages
       $connected = new WP_Query( array(
         'connected_type' => 'event_to_team',
         'connected_items' => get_queried_object(),
         'nopaging' => true,
       ) );
   
       // Display connected pages
       if ( $connected->have_posts() ) :
       ?>
       <h3>Featuring:</h3>
       <ul>
       <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
           <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
       <?php endwhile; ?>
       </ul>
   
       <?php
       // Prevent weirdness
       wp_reset_postdata();
   
       endif;
       ?>
       ```
   
 * The above code is copied directly from the Plugin’s documentation.
 * I edited it to this:
 *     ```
       <?php
       			// Find connected pages
       			$connected = new WP_Query( array(
         			'connected_type' => 'event_to_team',
         			'connected_items' => get_queried_object(),
         			'nopaging' => true,
       			) );
   
       			// Display connected pages
       			if ( $connected->have_posts() ) :
       			?>
       			<h3>Featuring: <?php while ( $connected->have_posts() ) : $connected->the_post(); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
   
       			<?php endwhile; ?>
   
       			<?php
       			// Prevent weirdness
       			wp_reset_postdata();
   
       			endif;
       			?>
       ```
   
 * Now the connected posts aren’t showing up as a list, but there is still a `<br
   >` between them. I’m attempting to get them to show up next to each other, separated
   by commas.
 * I think the fix is simple, but I’m fairly new to PHP and can’t get it to behave
   like I want!
 * Any help would be awesome.
 * Thanks all!

The topic ‘[Plugin: Posts 2 Posts] Displaying connected posts as comma separated
list’ is closed to new replies.

## Tags

 * [posts-2-posts](https://wordpress.org/support/topic-tag/posts-2-posts/)

 * 0 replies
 * 1 participant
 * Last reply from: [anthonydoes](https://wordpress.org/support/users/anthonydoes/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/plugin-posts-2-posts-displaying-connected-posts-as-comma-separated-list/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
