简体   繁体   中英

Simple javascript for wordpress plugin

I am busy with a wordpress site. I am using a plugin called wp-imageflow2, it uses the discription of the image when its upload to make a link, from what I gathered it looks for http to make a link. I need the images to link to a mailto tag.

So far I have a link to a html page in the description of the imageflow. Within the html page I have the code below. It works fine except it uses the html link in the address bar. How would I first create a new tab, open the email address in the email client and with a delay close the new tab. That should leave you on your original page. Is this possible?

<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 row 227

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

just add a few more lines here:

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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