• Resolved therinjfoundation

    (@therinjfoundation)


    Here is the question.
    Using “transitional”
    If I wish to use the same theme for html and AMP, but for AMP use a different header.php i.e.: header_amp.php
    How would I do that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @therinjfoundation

    Thank you for contacting us, Yes you can use a different header for AMP pages

    You can use the amp_is_request function to determine if you are on the AMP page.

    eg:

    if ( function_exists( 'amp_is_request' ) && amp_is_request() ) {
    	get_header( 'amp' );
    } else {
    	get_header();
    }

    Now add header-amp.php in your themes directory (in case you are using a theme from the WordPress repo, we will recommend using a child theme.)

    Also please note that it’s not an underscore (_) but it’s dash (-) that need while creating a custom header.

    You can learn more about it in WordPress documentation about get_header()

    I hope this helps!

    Plugin Support Milind More

    (@milindmore22)

    @therinjfoundation As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using a different header.php for AMP (header_amp.php)’ is closed to new replies.