Forums

[resolved] need lowercase output for comment_author_link (5 posts)

  1. typenerd
    Member
    Posted 4 years ago #

    so I've got usernames with mixed case, but I need to output them all lowercase with something like comment_author_link; how can I do that?

  2. Jeremy Clark
    Moderator
    Posted 4 years ago #

    just wrap the comment_author_link in a span tag and style it.
    Like this
    <span style="text-transform:lowercase;"><?php comment_author_link() ?></span>

  3. alexleonard
    Member
    Posted 4 years ago #

    Also, if you are already wrapping the comment author link within a paragraph or something, you could gain greater flexibility by doing this in your template:

    <p class="lowercase"><?php comment_author_link() ?></p>

    and then in your style sheet you can add a rule for this:

    .lowercase {text-transform: lowercase;}

    This would allow you to re-use that class if you want to force more items to be lowercase. This reduces repetition and keeps all your style rules in one place.

    Obviously the above method will work absolutely fine though :)

  4. typenerd
    Member
    Posted 4 years ago #

    hi guys.

    I can't use text-transform because I'm referencing a filename in an image tag; it's gotta be legit lowercase text.

    I was trying to use some kind of print_r, but I'm thinking maybe I just need to reference the username instead of the display name.

    Is there a way to force the output of a function back into a variable so I can manipulate the string? I thought I could with print_r and the true flag.

  5. typenerd
    Member
    Posted 4 years ago #

    fixed, I used

    echo strtolower(get_comment_author());

Topic Closed

This topic has been closed to new replies.

About this Topic