Showing author page if user has no post

<?php $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); ?> <?php if ( have_posts() ) ?> <h2>Posts by <?php echo $curauth->nickname; ?>:</h2> <ul> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/106902/<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”> <?php the_title(); ?></a>, <?php the_time(‘d M Y’); ?> … Read more

Where to add the permalink in this function?

Make use of the get_comment_link function in your foreach loop like so: foreach ($comments as $comment) { $output .= ‘<li><strong>’ . $comment->comment_author . ‘ said</strong> : “‘ . ‘<a href=”‘ . get_comment_link( $comment->comment_post_ID ) . ‘”>’ . strip_tags($comment->com_excerpt) . ‘…”</a></li>’; }