【发布时间】:2015-10-15 15:54:40
【问题描述】:
我将链接粘贴到 WordPress TinyMCE 编辑器中,如下所示: https://gist.github.com/kolesnikof/642ae1317cc23b87977f/
我得到像这样的 oEmbed 对象:http://prntscr.com/7wlsrz
通过将代码放在functions.php中,如下所示:
<?php
/**
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/2926827
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/2926827?file=embed-gist.php
*/
wp_embed_register_handler( 'gist', '/https:\/\/gist\.github\.com\/(\d+)(\?file=.*)?/i', 'wp_embed_handler_gist' );
function wp_embed_handler_gist( $matches, $attr, $url, $rawattr ) {
$embed = sprintf(
'<script src="https://gist.github.com/%1$s.js%2$s"></script>',
esc_attr($matches[1]),
esc_attr($matches[2])
);
return apply_filters( 'embed_gist', $embed, $matches, $attr, $url, $rawattr );
}
?>
我的问题:我想突出显示 oEmbed 代码,但我不知道 ajax 完成加载 oEmbed 内容时的事件处理程序触发
【问题讨论】:
标签: javascript ajax wordpress tinymce embed