Register Embed For Padlet
-
I’ve been asked by education clients for an easy to embed Padlet.com content from a content URL (w/o copying HTMLembed code). I notice on the Padlet.com site that it says this is supported on WordPress.com but not self-hosted.
Yes it works there
https://cogdogblog.wordpress.com/2020/02/28/padlets-embed-here/Why are more sites supported for embeds on WP.com than WP.org? Why do I not get the WP.com support with JetPack plugin?
I’m trying to write my own
wp_embed_register_handler
code and it keeps failing:add_action( 'init', 'wp_register_padlet_embed'); function wp_register_padlet_embed(){ $regex_url = '#https?://padlet\.com/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$#i'; wp_embed_register_handler( 'padlet', $regex_url, 'wp_embed_handler_padlet' ); } function wp_embed_handler_padlet( $matches, $attr, $url, $rawattr ) { $embed = sprintf( '<div class="padlet-embed"><iframe src="//padlet.com/embed/%1$s" frameborder="0" allow="camera;microphone;geolocation"></iframe></div>', esc_attr($matches[2]) ); return apply_filters( 'embed_padlet', $embed, $matches, $attr, $url, $rawattr ); }
But I keep getting fail to embed errors. There’s not much I can see to debug this, I am thinking it’s my weak regex skills, but this function is really poorly documented (the examples are outdated)
I’d be happy to see
wp_embed_register_handler
code used on WP>com I can compare to my own that is not working.
- The topic ‘Register Embed For Padlet’ is closed to new replies.