amp-wp icon indicating copy to clipboard operation
amp-wp copied to clipboard

Error functions.php

Open alessandromoretti90 opened this issue 10 years ago • 2 comments

Hi,

We have implemented this code to functions.php to show the picture show but he shows us this error.

add_action( 'pre_amp_render_post', 'xyz_amp_add_custom_actions' );
function xyz_add_custom_actions() {
    add_filter( 'the_content', 'xyz_amp_add_featured_image' );
}

function xyz_amp_add_featured_image( $content ) {
    if ( has_post_thumbnail() ) {
        $image = sprintf( '<p class="xyz-featured-image">%s</p>', get_the_post_thumbnail() );
        $content = $image . $content;
    }
    return $content;
}

This is error -> http://overpress.it/2016/02/11/diego-piacentini-commissario-governo-digitale/amp/

alessandromoretti90 avatar Feb 18 '16 12:02 alessandromoretti90

You are missing the amp on the function name, it should be xyz_amp_add_custom_actions and you have xyz_add_custom_actions.

j3j5 avatar Feb 18 '16 14:02 j3j5

Thanks for the reply :)

Now how can I give a style the image? I would like to resize the image and put it edge to edge if possible.

See this -> 421235137_12678478975821115101

How can I do?

alessandromoretti90 avatar Feb 18 '16 15:02 alessandromoretti90