Forums

[resolved] commenter's link (3 posts)

  1. superjux
    Member
    Posted 6 years ago #

    Hi.

    On my blog, commenters are required to enter their name and their email address, but not a url. If they leave the url field blank, their name still appears as a link, and it points to the post they are commenting on.

    Is it possible to make it so that if the url field is blank, their name does not show up as a link?

    Thanks!

    Hilary

  2. Kafkaesqui
    Moderator
    Posted 6 years ago #

    Here's a mod of what I use in my theme's comments.php (note that if your theme does not have a comments.php, it uses the one that comes with the default theme):

    <?php if(get_comment_author_url()) : ?>
    <a href="<?php comment_author_url(); ?>"><?php comment_author(); ?></a>
    <?php else :
    comment_author();
    endif; ?>

  3. superjux
    Member
    Posted 6 years ago #

    Cool, it worked!

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.