Support » Plugin: AMP » Reader mode – Support for custom port types – templates

  • Resolved kujain

    (@kujain)


    Hi there!

    Hoping this is an easy issue to sort out, but I am not able to make it happen:

    1. I am integrating the plugin using the reader mode option (transitional/standard is a bigger lift that I cannot take for now, and we really need a straight-forward amp view of our pages). I have setup a custom amp folder within my custom built them folder.
    2. I have multiple custom post types and have enabled them int he settings page.
    3. The custom post works and shows the amp view, but ONLY when the wp post template is default. I have a few templates options for each post type and if I choose one of the others, then it stops working and I get redirected to the safe view, with no errors etc (also the block editor’s AMP publish metabox never enables).
    4. But if I remove the custom WP template for that post then the AMP reader theme template loads fine.

    Is there some restriction on using custom wp templates with custom post types in reader mode? I went through the documentation and wiki, but due to outdates posts in some places i am not sure.

    If the above is true, and I cannot use reader mode here, would the next easier option be to work with transitional mode and update my custom theme accordingly?

    Thanks very much!

    • This topic was modified 1 month, 1 week ago by kujain.
    • This topic was modified 1 month, 1 week ago by kujain.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    The ideal is to use Transitional or better Standard, but you can use Reader mode when custom page templates are assigned. You just have to explicitly enable AMP for such pages. Look for the “Enable AMP” toggle on the edit post screen. Pages with custom templates and the homepage default to not having AMP enabled in Reader mode since the template is often not appropriate.

    In Transitional/Standard mode, the templates in AMP are exactly the same as non-AMP so this isn’t relevant.

    Thanks for your reply Weston!

    Actually, the manual enabling in the editor UI doesn’t work for me (as mentioned in 3 above). When I try to enable it and update, the checkbox goes back to disabled, as is some validation errors prevented enabling it. Which doesn’t make sense since in reader mode, the post should have simply used the default reader theme! Also, there’s no validation console (or even in debug) in reader mode, so I am not able to see if that was the issue here.

    Debugging the post_supports_amp() function, i see the error on the post amp page before it redirect as Array ( [0] => post-status-disabled ). So for some reason, even though I have enabled the CPT in the settings, changing the default post theme from default to another, disables the support, it appears.

    The only way I would find to get around is to force enable AMP across all content through:
    add_filter( ‘amp_post_status_default_enabled’, ‘__return_true’ );

    Now amp works across all CPT and its template variants, but the editor Enable AMP toggle cannot be used anymore to disable it where needed.

    Thanks!

    Plugin Author Weston Ruter

    (@westonruter)

    Perhaps it is an issue with your theme? Does the issue happen with a core theme active?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.