I have made a small function (WordPress), using echo .
/* .. Some code */
switch ($linktype) {
case "next":
echo '<p class="next">' . previous_post_link('%link',''.$prevthumbnail.'') . '</p>';
break;
case "prev":
echo '<p class="prev">' . next_post_link('%link',''.$nextthumbnail.'') . '</p>';
break;
}
/* .. Some other code*/
Using the "regular" concatenation syntax that I know...
echo '<p class="next">'. previous_post_link('%link',''.$prevthumbnail.'') . '</p>';
...produces...
<p class="next"></p>< result of previous_post_link() >
I obviously need <p class="next">< result of previous_post_link() ></p>. I have found some post suggesting to replace the dots ('.') with commas (','), so now I have...
echo '<p class="next">' , previous_post_link('%link',''.$prevthumbnail.'') , '</p>';
...which works. Is this a "correct" way to address the problem, or is this just a "hack" that works? Is there a better approach?