• Resolved andrelost

    (@andrelost)


    Hi everybody,

    I’d like to add the link to the non-amp post ONLY at the end of the AMP post version.
    Does somebody know if it’s possible?

    Thank you,
    Andrea

Viewing 1 replies (of 1 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    Yes. Try adding this to your theme’s functions.php:

    add_filter( 'the_content', function( $content ) {
            if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
                    $content .= sprintf( '<p><a href="%1$s">%2$s</a></p>', get_permalink(), __( 'Non-AMP version.', 'my-theme' ) );
            }
            return $content;
    }, 200 );
    
    • This reply was modified 8 years, 7 months ago by Weston Ruter.
Viewing 1 replies (of 1 total)

The topic ‘Custom content on AMP post’ is closed to new replies.