Viewing 5 replies - 1 through 5 (of 5 total)
  • I’d like to second this request and ask for information on how to get the featured image appearing at the top of the page as this has been dropped in the AMP version. Does it need to be called in a certain way in the AMP templates?

    Thanks, John

    I had the same problem, and Image is requested to validate Schema.org

    This is my fix :

    – edit the build_metadata() function inside class-amp-post.php and add image information like this :

    'image' => array(
         '@type' => 'ImageObject',
         'url' => wp_get_attachment_url( get_post_thumbnail_id($post->ID) ),
    	'width' => wp_get_attachment_metadata( get_post_thumbnail_id($post->ID) )[width],
    	'height' => wp_get_attachment_metadata( get_post_thumbnail_id($post->ID) )[height]
    ),

    You will have to do the same thing with your logo, inside the publisher section (but url, width and height can be static in this case)

    I think it worked because the errors from Google structured data testing tool are gone…

    Hi Guillaume,

    Thanks so much that worked like a charm for the errors but still I’m not getting the image coming up, think I can figure how to call it and get that working.
    So for the logo I just need to provide a static URL for the logo and provide height and width details, I don’t need to fetch the information from WP?

    I seem to get images appearing in some cases and in others you have to click on them and then they all appear, it looks very similar to the lazy load technique where I can see an amp-filler class: “-amp-fill-content -amp-replaced-content”. Is there something that needs to be done for images to appear, because scrolling doesn’t seem to be the trigger…?

    Thanks,

    John

    Hello John,

    Concerning the logo, you have to provide informations in the Organization section, like this :

    'publisher' => array(
          '@type' => 'Organization',
          'name' => get_bloginfo( 'name' ),
          'logo'=> array(
                 '@type' => 'ImageObject',
    	     'url' => *your logo url*,
    	     'width' => *your logo width*
                 'height' => *your logo height*
    	)
    ),

    Of course you can use the logo from your WordPress website but be aware that the logo height must not exceeds 60 pixels, it’s a specification from Google :

    Thanks Guillaume, that’s amazing and thanks for the tip about the logo height ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Include image’ is closed to new replies.