WordPress.org

Forums

[resolved] Help with PHP (6 posts)

  1. junipingla
    Member
    Posted 9 years ago #

    In my comment template I have this code:

    <?php foreach ($comments as $comment) : ?>
    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == 'xxxx@xxxxxx.xxx') {
    $isByAuthor = true;
    }
    ?>
    
    <li class="<?php echo $oddcomment; ?> <?php if($isByAuthor ) { echo 'authorcomment';} ?>" id="comment-<?php comment_ID() ?>">
    
    <cite><?php comment_author_link() ?></cite> skriver:
    			<?php if ($comment->comment_approved == '0') : ?>
    			<em>Your comment is awaiting moderation.</em>
    			<?php endif; ?>

    It make my own comments stand out. Now I would like to change this part "skriver:"
    When it's my own admin comments I would like it to display "svarar:" instead. Any kind soul who can help me with the code?

    Thanks! :))

  2. whooami
    Member
    Posted 9 years ago #

    change this:

    </cite> skriver:

  3. junipingla
    Member
    Posted 9 years ago #

    Whoooami: But I need a php snippet to use, it should be skriver: for all regular comments but svarar: when it's one of my own.

  4. whooami
    Member
    Posted 9 years ago #

    i dont understand what you are asking.

    XXxxxxXX

    Nevermind, I get it .. skriver is comment in whatever language or something..

  5. junipingla
    Member
    Posted 9 years ago #

    I solved it my self, thanks for your time. I added:
    <?php if($isByAuthor ) { echo 'svarar:'; }else echo 'skriver:'; ?>

  6. junipingla
    Member
    Posted 9 years ago #

    Yes "skriver" means "says" in swedish :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags