I have a while loop that is giving me some formatting issues when it renders in browser. I am trying to list some posts (comma separated) in a paragraph tag.
$postCount = 0;<br />
echo '<p>';<br />
while ( $platforms->have_posts() ) : $platforms->the_post();?><br />
<a>" title="<?php the_title();?>"><?php trim(the_title());?></a><br />
<?php<br />
++$postCount;<br />
if ($postCount < $platforms->found_posts) {<br />
echo ", ";<br />
}<br />
endwhile;<br />
echo '</p>';
However when I look at the HTML source, there’s all this extra white space that is adding an extra space in the browser view.
<p> <a href="mysite" title="TitleA">TitleA</a><br />
, <a href="mysite" title="TitleB">TitleB</a><br />
, <a href="mysite" title="TitleC">TitleC</a><br />
</p>
So instead of my format looking like this: TitleA, TitleB, TitleC
There is extra space before the comma.
TitleA , TitleB , TitleC
Is there something in wordpress php that is causing each Title link to go to a separate line? I would expect the source to look like this
<p><a href="mysite" title="TitleA">TitleA</a>, <a href="mysite" title="TitleB">TitleB</a>, <a href="mysite" title="TitleC">TitleC</a></p>