繁体   English   中英

用于 wordpress 插件的简单 javascript

[英]Simple javascript for wordpress plugin

我正忙于 wordpress 站点。 我正在使用一个名为 wp-imageflow2 的插件,它在上传时使用图像的描述来建立链接,根据我收集的内容,它会寻找 http 来建立链接。 我需要将图像链接到 mailto 标签。

到目前为止,我在图像流的描述中有一个指向 html 页面的链接。 在 html 页面中,我有以下代码。 它工作正常,只是它使用地址栏中的 html 链接。 我将如何首先创建一个新选项卡,在 email 客户端中打开 email 地址并延迟关闭新选项卡。 那应该让您留在原始页面上。 这可能吗?

<script>
 function myFunc(){
 location.href="mailto:name@name.co.za";
 window.open('newwindow', config='height=50, width=50')
 window.setTimeout("window.close()", 1000);

}
</script>
</head>
<body onload="myFunc();">
</body>

wp-imageflow2.php 行 227

if (($link == 'true') && (substr($attachment->post_content,0,7) == 'http://')) $linkurl = $attachment->post_content;

只需在此处添加几行:

else if (($link == 'true') && (substr($attachment->post_content,0,8) == 'https://')) $linkurl = $attachment->post_content;
else if (($link == 'true') && (substr($attachment->post_content,0,7) == 'mailto:')) $linkurl = $attachment->post_content;
else if (($link == 'true') && (substr($attachment->post_content,0,6) == 'ftp://')) $linkurl = $attachment->post_content;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM