• I need little bit help and customization on my existng script at function.php for wordpress 3.5. Here’s what I have. As you can see here the default picture is none exist will be using

    $first_img = $img_dir . '/images/post-default.jpg';

    I would like to know if there would be possibility to just grab author’s posts picture. Please find below the whole code related to this function.
    I really appreciated any recomendation…

    ////////////////////////////////////////////////////////////////////////////////
    // Get Standard Post Image
    ////////////////////////////////////////////////////////////////////////////////
    function get_post_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
    
      if(empty($first_img)){ //Defines a default image
        $img_dir = get_bloginfo('template_directory');
        $first_img = $img_dir . '/images/post-default.jpg';
      }
      return $first_img;
    }
  • The topic ‘Author Avatar as default first image’ is closed to new replies.