Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #170830

    Hi

    This is my first query. I use Yeost SEO and I am finding the combination of this and Flashlight great for my SEO. However, I upload a lot of photos into my blog posts via the gallery options and use the 3 Grid to display them in my posts as I like this look the best. The problem is that Yeost SEO tells me on every post that I have no images inserted. This is giving me a red mark in Yeost and when I Google my name I don’t see any images from my Flashlight website, only old images from my old Blogger blog.

    Am I missing something to make my images appear in my posts for SEO. To clarify, they are view-able in my posts without any problem, it is just the SEO side that is an issue for me at the moment. My business is photography so I need my images to appear in Google and at the moment Flashlight is not helping me achieve this.

    Below is a screen grab of my SEO analysis from a recent post.

    My SEO Review with no images in my post warning

    #172137

    Hey jamest17!

    Add following code to the functions.php file (insert it at the very bottom) and Yoast SEO should recognize the images:

    
        function avia_wpseo_pre_analysis_gallery_content_fix($content)
        {
            global $post;
    
            if(is_admin() && !empty($post->ID))
            {
                $attachments = avia_post_meta($post->ID, 'slideshow');
                if(!empty($attachments))
                {
                    foreach($attachments as $key => $attachment) 
                    {
                        if(is_array($attachment))
                        {
                            $att_id = $attachment['slideshow_image'];
                        }
                        else
                        {
                            $att_id = $attachment->ID;
                        }
                    
                        if(!empty($att_id)) $content .= ' ' . wp_get_attachment_image($att_id, 'full') . ' ';
                    }
                }
            }
            return $content;
        }
        add_filter('wpseo_pre_analysis_post_content','avia_wpseo_pre_analysis_gallery_content_fix', 10, 1);
    

    Best regards,
    Peter

    #172365

    I added the code and when I hit update my site crashed. I now get a server error and cannot view or login to my site? What’s happened?

    #172715

    I forgot to remove an unnecessary line ( $this->image_meta_content[$att_id] = $attachment; ) – I corrected the code and it should work now.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Images in Blog Posts not counting towards my SEO’ is closed to new replies.