0

For 2 days I'm struggling and hitting my head to find out the solution but no thing. The website isn't loading images on front-page and news-ticker not working at all.

I tried to re-uploading the theme more than once. I tried disabling all plugins

Nothing the problem persist.

   function eff_post_image($size = ''){
    global $post;
    $image = '';
    //get the post thumbnail
    $image_id = get_post_thumbnail_id($post->ID);
    $image = wp_get_attachment_image_src($image_id,  
    $size);
    $image = $image[0];
    if ($image) return $image;
    //if the post is video post and haven't a feutre image
    $type = get_post_meta($post->ID, 'eff_article_type', true);
    $vtype = get_post_meta($post->ID, 'eff_video_type', true);
    $vId = get_post_meta($post->ID, 'eff_video_id', true);
    if($type == 'video') {
                    if($vtype == 'youtube') {
                      $image = 'http://img.youtube.com/vi/'.$vId.'/0.jpg';
                    } elseif ($vtype == 'vimeo') {
                    $hash = unserialize(wp_remote_get("http://vimeo.com/api/v2/video/$vId.php"));
                      $image = $hash[0]['thumbnail_large'];
                    } elseif ($vtype == 'daily') {
                      $image = 'http://www.dailymotion.com/thumbnail/video/'.$vId;
                    }
            }
    if ($image) return $image;
    //If there is still no image, get the first image from the post
    return eff_get_first_image();
    }
    function eff_get_first_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)) {
        $first_img = "/images/default.jpg";
      }
      return $first_img;
    }

    // First Image 
    function catch_that_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
      $first_img = EFF_IMG . "/default.png";
    }
    return $first_img;
      }
9
  • How are you trying to display the images? Looks like the src for the logo is an Array() so something isn't right. As for the newticker I suggest looking at your JS console as there are some errors. Other than that it's always advised to turn on debugging in case there are any PHP errors that are being supressed.
    – Howdy_McGee
    Jul 8, 2015 at 14:43
  • @Howdy_McGee thanks for your comment. The images are parsed by php <img itemprop="image" src="<?php echo post_image(); ?>" width="250" height="143" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /> Through Google Chrome I checked but I don't get exact error what is it
    – Zaher
    Jul 8, 2015 at 16:22
  • P.S. debugger already active but nothing shown
    – Zaher
    Jul 8, 2015 at 16:23
  • Edit your question with what the post_image() function included, code is difficult to read as comments.
    – Howdy_McGee
    Jul 8, 2015 at 16:34
  • @Howdy_McGee done please check up
    – Zaher
    Jul 8, 2015 at 16:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.