• Hi there!

    I use a plugin where user can upload their avatars on the frontend. I want to use the same
    pictures in the comments, but i am a little bit confused about the template structure.

    The plugin author kindly passed me this code snippet to call the frontend avatars.
    get_user_meta($user_id, 'iv_profile_pic_thum',true);

    I went to templates/content/comments and thought the right file should be the comment.php.

    Could someone point me to the right way? 😀

    best regards:D

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,
    You are right. Make a copy of this file and its path(Create the folders templates/content/comments and copy the file comment.php from the parent theme into this) in your child theme.
    You can modify this template file to add your code, depending on where you want the avatar to be displayed.

    Thread Starter guybrushpixelwood

    (@guybrushpixelwood)

    I tried your solution, but there is no change. The strange thing is: There is even no change if I edit the file in the parent theme.

    <?php
    /**
     * The template for displaying the single comment
     *
     * @package Customizr
     * @since Customizr 3.5.0
     */
    ?>
    <li <?php comment_class() ?> id="comment-<?php comment_ID() ?>" <?php czr_fn_echo('element_attributes') ?>>
      <div id ="div-comment-<?php comment_ID() ?>" class="comment-section clearfix">
      
       <div class="col-avatar">
          <figure class="comment-avatar">
           <?php
    				  	$iv_profile_pic_url=get_user_meta($get_the_author_meta->ID, 'iv_profile_pic_thum',true);
    				  	if($iv_profile_pic_url!=''){ ?>
    					 <img src="<?php echo $iv_profile_pic_url; ?>">
    					<?php
    					}else{
    					 echo'	 <img src="'. WP_iv_membership_URLPATH.'assets/images/Blank-Profile.jpg">';
    					}
    				  	?>
          </figure>
        </div>

    This is the code I tried to call the user uploaded avatar pictures in the comments. I wanted to replace the gravatar images with this ones. But there is really absolute no change in the frontend.

    This is really strange, it looks like this comment.php does not affect the comment section under my posts.

    Hi,
    In that case, try clearing the cache.
    Do post your site url too.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Comment Author Pictures’ is closed to new replies.