• Hello,

    I am wondering if you have plans to add an example of using Custom Sanitizer along with AMP_DOM_Utils (for example, add_amp_action) in themes. Something similar what you’ve done for a default WordPress theme in the plugin’s core.

    I’ve checked documentation and it seems like it’s currently not possible to use AMP_DOM_Utils and add_amp_action.

    I really like this approach of using Custom Sanitizer in themes because it allows to add support for AMP without a need to modify the theme template parts. Also, we can load this kind of functionality only when AMP plugin is active.

    Kind regards,
    Taras

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

    (@westonruter)

    We have marked this class as internal, which is why it isn’t showing up in the documentation.

    Many of the methods in that class have been marked as deprecated as they have moved over to the amp-toolbox-php project dependency as part of the AmpProject\Dom\Document class.

    Nevertheless, there are plugins and a theme which are using AMP_DOM_Utils today in the directory, so we might as well make the class non-internal.

    I’ve opened a PR to remove the @internal designation: https://github.com/ampproject/amp-wp/pull/5902

    Just be aware that additional methods in the class may be deprecated in favor of code in the AmpProject\Dom namespace in future releases.

    Thread Starter Taras Dashkevych

    (@taskotr)

    Hi Weston,
    Thank you for always being helpful!

    I was able to implement support for AMP via a custom sanitizer thanks to the examples you’ve posted in this post and in the previous one.

    Kind regards,
    Taras

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Sanitizers: Example of using AMP_DOM_Utils in themes’ is closed to new replies.