• Resolved SuzuKube

    (@suzukube)


    I’m using the Typecore theme, and I have a lot of post with video in it – they are Post-Type video, with a “_video_url” metakey containing the youtube video URL.

    On Better AMP, no problem, it supports the video ! But on AMP Automattic, you just have a place holder instead of the video.

    I tried with this :

    /**
     * On AMP endpoints for posts with a 'video' format, don't display a featured image.
     *
     * @param string  $markup The markup of the post thumbnail.
     * @param int     $post_id The post ID.
     * @return string $markup The filtered markup.
     */
    add_filter( 'post_thumbnail_html', function( $markup, $post_id ) {
    	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && ( 'video' === get_post_format( $post_id ) ) ) {
    		return '';
    	}
    	return $markup;
    }, 10, 2 );

    On posts with the format of ‘video,’ display the YouTube video at the top of the post content:

    /**
     * On AMP endpoints for posts with a 'video' format, display the YouTube video at the top of the post.
     *
     * @param string  $markup The post content.
     * @return string $markup The filtered post content.
     */
    add_filter( 'the_content', function( $markup ) {
        	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && ( 'video' === get_post_format() ) ) {
    		return 'Video markup here' . $markup;
    	}
    	return $markup;
    } );

    But it doesn’t work at all, nothing happen… I would love to go back to Auttomatic AMP, but I can’t without the youtube videos ?? !

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Post Type video not supported ?’ is closed to new replies.