• Hi,

    I’m using the latest version of Customizr. How do I upload a pic for the author bio on a post? I have the “Custom User Profile Photo” plugin but according to instructions, in order for the photo to show on the post page one must paste the following code into the single.php file:

    <?php
    // Retrieve The Post's Author ID
    $user_id = get_the_author_meta('ID');
    // Set the image size. Accepts all registered images sizes and array(int, int)
    $size = 'thumbnail';
    
    // Get the image URL using the author ID and image size params
    $imgURL = get_cupp_meta($user_id, $size);
    
    // Print the image on the page
    echo '<img src="'. $imgURL .'" alt="">';
    ?>

    Since there is no single.php can you please tell me where to paste? Or if there is another way to get the pics to show? Thanks in advance.

Viewing 1 replies (of 1 total)
  • Hi oshun55,
    you might want to add the following code to your child-theme functions.php:

    add_filter('get_avatar', 'my_custom_avatar', 100);
    function my_custom_avatar( $avatar ){
      global $wp_current_filter;
      if ( ! ( ( is_single() && ! in_array('__comment', $wp_current_filter) ) || is_author() ) )
        return $avatar;
    
      $user_id = get_the_author_meta('ID');
      // Set the image size. Accepts all registered images sizes and array(int, int)
      $size = 'thumbnail';
    
      // Get the image URL using the author ID and image size params
      $imgURL = get_cupp_meta($user_id, $size);
      // Print the image on the page
      return '<img src="'. $imgURL .'" alt="author" class="avatar avatar-'.$size.' photo">';
    }

    This will show you the custom profile pic in the author box:
    https://doc.themesandco.com/customizr/global-settings/#authors

    Is this what you wanted?

Viewing 1 replies (of 1 total)
  • The topic ‘How to upload Author photo?’ is closed to new replies.