Good question. Here’s an example plugin which will allow you to add those attributes by “hacking” the block class names: https://gist.github.com/westonruter/9610b49e3138ec95a000590dddd13044
It would be nice if there was an actual UI to supply the FX properties, but we would want to wait to investigate that further until they are available on non-AMP pages as well via Bento. We want to avoid the current situation where we have some AMP-specific settings in the editor that don’t work on non-AMP pages.
We considered adding special effects this in the past: https://github.com/ampproject/amp-wp/issues/1257
That’s awesome, once I realized not to add the quotes it worked perfectly. I’ve been trying to figure out a way to do that for a while. I assume it doesn’t matter that it also adds the attributes as classes, but they should just be ignored anyway. Everytime I ask a question you have a solution in a few minutes, thanks!
One issue I noticed, if you want to add two attributes it doesn’t seem to work, for example amp-fx=fade-in fly-in-right. Would this be possible to implement?
Also I know this is not related to your plugin but do you know if there is a way to disable amp-fx with a media query? For example disabled for mobile widths.
-
This reply was modified 3 years, 1 month ago by rsmith4321.
-
This reply was modified 3 years, 1 month ago by rsmith4321. Reason: Added issue with two attributes
That’s awesome, once I realized not to add the quotes it worked perfectly.
Correct, it requires omission of the quotation marks.
I assume it doesn’t matter that it also adds the attributes as classes, but they should just be ignored anyway.
Right, they’ll just be extra classes that don’t do anything.
One issue I noticed, if you want to add two attributes it doesn’t seem to work, for example amp-fx=fade-in fly-in-right. Would this be possible to implement?
I just adjusted it so that you can supply multiple effects separated by a comma, like so: amp-fx=fade-in,fly-in-right
.
Also I know this is not related to your plugin but do you know if there is a way to disable amp-fx with a media query? For example disabled for mobile widths.
Good question. I am not sure about that. That would be a good question on Stack Overflow.