php 将Featherlight JS添加到WordPress发布the_content

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 将Featherlight JS添加到WordPress发布the_content相关的知识,希望对你有一定的参考价值。

// Featherlight - Add Featherlight JS to WordPress posts the_content
add_filter('the_content', 'my_addfeatherlightrel');
function my_addfeatherlightrel($content) {
       global $post;
       $pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
       $replacement = '<a$1href=$2$3.$4$5 data-featherlight="$3.$4" title="'.$post->post_title.'"$6>';
       $content = preg_replace($pattern, $replacement, $content);
       return $content;
}

以上是关于php 将Featherlight JS添加到WordPress发布the_content的主要内容,如果未能解决你的问题,请参考以下文章

Featherlight是一个非常轻量级的jQuery灯箱插件。它';它简单而灵活,易于使用。Featherlight具有最小的css,并且不使用内联样式,所有内容都以名称分隔,它';s完

css 打开featherlight框时使背景变暗

php 将js添加到wp

php 将css / js添加到wordpress

php viewScroller.js |将viewScroller添加到Sage 9

php 数组 将指定元素移至末尾