Title: Avatar w komentarzu
Last modified: 2017-05-23

---

# Avatar w komentarzu

 *  [bakr1](https://pl.wordpress.org/support/users/bakr1/)
 * (@bakr1)
 * [9 lat, 4 miesiące temu](https://pl.wordpress.org/support/topic/avatar-w-komentarzu/)
 * Witam,
 * Problem polega na tym, że kiedy ktoś doda komentarz pod wpisem w miejsce avatara
   pojawia się avatar autora wpisu, a nie komentującego.
 * Plik comments.php:
 *     ```
       <div class="col-md-8">
   
         <h3>Komentarze:</h3>
   
         <?php cancel_comment_reply_link(); ?>
   
         <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
           <div class="form-group">
             <input type="text" name="author" id="author" value="<?php $current_user = wp_get_current_user();
        echo $current_user->user_firstname ?> <?php echo $current_user->user_lastname ?>"  class="form-control" <?php if ($req) echo "aria-required='true'"; ?> >
             <label for="author">Imię <?php if ( $req ) echo "( wymagane )"; ?></label>
           </div>
   
           <div class="form-group">
             <input type="email" name="email" id="email" value="<?php $current_user = wp_get_current_user();
        echo $current_user->user_email ?>" class="form-control" <?php if ($req) echo "aria-required='true'"; ?>>
             <label for="email">Email ( <?php if ( $req ) echo "wymagane"; ?> )</label>
           </div>
   
           <div class="form-group">
             <textarea name="comment" id="message"></textarea>
             <label for="comment">Twój komentarz (min. 15 znaków)</label>
           </div>
   
         <button class="submit">
         <?php do_action( 'comment_form', $post->ID ); comment_id_fields(); ?>Wyślij komentarz</button>
   
         </form>
   
       </div>
   
             <!-- Odwołanie się do funkcji wyglądu komentarzy z pliku functions.php -->
             <?php wp_list_comments(
               array(
                 'type'      =>  'comment',
                 'callback'  =>  'comments_feed_template_callback'
               )
             ); ?>
       ```
   
 * Plik function.php
 *     ```
       function comments_feed_template_callback($comment, $args, $depth) {
   
         $GLOBAL['comment'] = $comment;
   
         ?>
           <div class="comment-display">
             <a href="<?php get_comment_author_url(); ?>" class="pull-left img-circle">
   
             <? echo get_avatar( get_the_author_meta('user_email'), $size = '55'); ?>
             </a>
             <div class="comment-content">
               <h5 class="media-heading">
                 <a href="<?php get_comment_author_url(); ?>"><?php echo get_comment_author(); ?></a>
                 <small><?php comment_date(); ?> o <?php comment_time(); ?></small>
               </h5>
               <?php comment_text(); ?>
               <?php comment_reply_link(array_merge($args, array(
                 'reply_text' => __('<strong>Odpowiedz </strong><i class="icon-share-alt"></i>'),
                 'depth' => $depth,
                 'max_depth' => $args['max_depth']
               ))); ?>
             </div>
           </div>
           <hr>
         <?php
       }
       ```
   

Zobacz 1 odpowiedź (z 1 wszystkich)

 *  [Paweł](https://pl.wordpress.org/support/users/mrpauloen/)
 * (@mrpauloen)
 * [9 lat, 4 miesiące temu](https://pl.wordpress.org/support/topic/avatar-w-komentarzu/#post-64637)
 * Zamień:
    `get_avatar( get_the_author_meta('user_email'), $size = '55');` na: `
   get_avatar( $comment, $size = '55' );`
 * i wszystko powinno wrócić do normy 😉

Zobacz 1 odpowiedź (z 1 wszystkich)

 Temat ‘Avatar w komentarzu’ jest zamknięty na nowe odpowiedzi.

## Tagi

 * [awatar w komentarzu](https://pl.wordpress.org/support/topic-tag/awatar-w-komentarzu/)
 * [poprawny kod](https://pl.wordpress.org/support/topic-tag/poprawny-kod/)

 * W: [Zaawansowane](https://pl.wordpress.org/support/forum/zaawansowane/)
 * 1 odpowiedź
 * 2 uczestnik
 * Ostatnia odpowiedź od: [Paweł](https://pl.wordpress.org/support/users/mrpauloen/)
 * Ostatnia aktywność: [9 lat, 4 miesiące temu](https://pl.wordpress.org/support/topic/avatar-w-komentarzu/#post-64637)
 * Status: nierzwiązane

## Tematy

### Najbardziej popularne tematy

### Tematy bez odpowiedzi

### Wątki niezwiązane ze wsparciem

### Rozwiązane wątki

### Nierozwiązane tematy

### Wszystkie tematy
