Solution –
take out:
foreach($zg_get_title as $zg_title_out) {
echo "<a href=\"". get_permalink($value+0) . "\" title=\"". $zg_title_out->post_title . "\">". $zg_title_out->post_title . "</a>, \n"; // Output link and title
insert:
foreach($zg_get_title as $post) { echo "<a href=\"". get_permalink($value+0) . "\" title=\"". $post->post_title . "\">". apply_filters('the_title',$post->post_title) . "</a>; \n"; // Output link and title
$zg_title_out
was replaced with $post
,
and $zg_title_out->post_title
was replaced with $post->post_title