簡體   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