WordPress.org

Ready to get started?Download WordPress

Forums

Need Code to Alter Comments (3 posts)

  1. ccano
    Member
    Posted 7 years ago #

    I know that this code lets me alter the way my comment looks as opposed to others:

    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == 'me@myemail.com') {
    $isByAuthor = true;
    }
    ?>

    What I'm wondering is...

    How can I alter that code to apply to everyone EXCEPT a certain e-mail?

    I assume it would mean altering this part of the code:

    if($comment->comment_author_email == 'me@myemail.com')

    Anyone know how to accomplish this?

    Thanks.

  2. Kafkaesqui

    Posted 7 years ago #

    if( !($comment->comment_author_email == 'me@myemail.com') ) {

    ! = NOT in PHP lingo. So you're saying if comment author's email is NOT me@myemail.com, do the following. This works the same:

    if($comment->comment_author_email != 'me@myemail.com') {

  3. ccano
    Member
    Posted 7 years ago #

    That works. Thank you so much, I've been messing with the code all night trying to figure this out.

    Appreciate it :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.