Forums
Home / Fixing WordPress / How would I wrap this in an “if” statement
(@mark_i)
16 years, 3 months ago
For my registered commenters, I’d like to add this link to my comment template:
<a href="?author=<?php echo $comment->user_id ?>"><?php comment_author() ?></a>
What would I put around that code so that the link only appears for comments left by registered users?
I still want others to be able to comment, but I’d like this link to appear for the comments left by registered users.
Thanks!
figured it out! here it is in case others are interested:
<?php if ($comment->user_id) { ?> <a href="?author=<?php echo $comment->user_id ?>"><?php comment_author() ?></a> <?php } ?>
argh. I spoke too soon.
(@otto42)
WordPress.org Admin
Try if (!empty($comment->user_id)).
if (!empty($comment->user_id))
(@mark_i)
16 years, 3 months ago
For my registered commenters, I’d like to add this link to my comment template:
<a href="?author=<?php echo $comment->user_id ?>"><?php comment_author() ?></a>
What would I put around that code so that the link only appears for comments left by registered users?
I still want others to be able to comment, but I’d like this link to appear for the comments left by registered users.
Thanks!