WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using an if exists statement with author info tags (4 posts)

  1. jimmiejo
    Member
    Posted 5 years ago #

    I'm trying to use an if exists statement to determine whether or not a commenter has entered a link, and apply different classes/include different info depending if they have or haven't.

    Figured something like this:

    <?php if (function_exists('comment_author_url_link')) {
    	echo 'yes';
    	} else {
    	echo 'no';
    } ?>

    ...would do the trick, but it displays 'yes' no matter whether or not the commenter included a link with their comment.

    I had asked a similar question a month or so ago about using an if exists statement with custom fields (link), and scribblerguy was kind enough to help with an undocumented function.

    Is there a similar undocumented method of doing this? Or am I missing something really simple? :)

  2. danphilibin
    Member
    Posted 5 years ago #

    I'm probably wrong, but doesn't the function still exist even if the value is blank?

  3. jimmiejo
    Member
    Posted 5 years ago #

    I may have found a solution (or at least a starting point) here:

    http://wordpress.org/support/topic/131944?replies=9

    I'll update/close this thread if that works.

  4. jimmiejo
    Member
    Posted 5 years ago #

    <?php if ($comment->comment_author_url != '') echo 'hell yeah'; else echo 'hell no'; ?>

    That does the trick. :)

Topic Closed

This topic has been closed to new replies.

About this Topic