• Hi,

    I updated to 0.4.2 and was excited to see the customizer function, but none of the changes I’ve added are showing up in google like they do in preview. Is there a lag time between updating the plugin and pages reflecting the changes or is something else wrong? Please help!

    My site: https://smellslikeinfinitesadness.com/

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • For your featured image problem, try adding this to your functions.php file.

    /**
    
     * Template tag to show featured image on AMP
    
     * @param string $size the post thumbnail size
    
     */
    
    function isa_amp_featured_img( $size = 'medium' ) {
    
     
    
        global $post;
    
         
    
        if ( has_post_thumbnail( $post->ID ) ) {
    
     
    
            $thumb_id = get_post_thumbnail_id( $post->ID );
    
            $img = wp_get_attachment_image_src( $thumb_id, $size );
    
            $img_src = $img[0];
    
            $w = $img[1];
    
            $h = $img[2];
    
     
    
            $alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
    
             
    
            if(empty($alt)) {
    
                $attachment = get_post( $thumb_id );
    
                $alt = trim(strip_tags( $attachment->post_title ) ); 
    
            } ?>
    
            <amp-img id="amp-feat-img" src="<?php echo esc_url( $img_src ); ?>" <?php
    
                if ( $img_srcset = wp_get_attachment_image_srcset( $thumb_id, $size ) ) {
    
                    ?> srcset="<?php echo esc_attr( $img_srcset ); ?>" <?php
    
                }
    
                ?> alt="<?php echo esc_attr( $alt ); ?>" layout="responsive" width="<?php echo $w; ?>" height="<?php echo $h; ?>">
    
            </amp-img>
    
            <?php
    
        }
    
    }
    
    Thread Starter SLIS

    (@slis)

    Thank you KC! I will give that a shot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Featured Images not showing in AMP 0.4.2.’ is closed to new replies.