【发布时间】:2013-10-14 19:56:33
【问题描述】:
我需要 facebook/twitter/email 按钮来共享加载了照片的页面。照片表单的脚本是几年前由一位离开的同事编写的,我得出结论认为这是我无法自定义的东西。我已经包含了我能想到的尽可能多的信息。谢谢!
编辑:我可以为任何想为我试一试的人提供 wp 登录详细信息。非常感谢!
- 转到此页面:etncal.staging.wpengine.com/community-event-photos/
- 输入 ID#09070073,点击获取照片按钮
- 新页面加载,网址将显示为:etncal.staging.wpengine.com/download-your-community-event-photos/?photo=090700731381779074495
- url传了个参数,输入的照片码是前8位
- 共享此按钮链接到不带参数的页面 url - 因此共享没有加载图像的空白页面。需要分享具有唯一网址和照片的页面。
社区活动照片表单使用两个页面:
1] 带有表单的页面: etncal.staging.wpengine.com/community-event-photos/
添加到本页正文的代码:
[js]varUnique=new Date().getTime() //will always be unique
function CheckForm() {
var photoID = document.photoForm.photoID.value;
var numericExpression = /^[0-9]+$/;
var eightdigit = /^\d{8}$/;
if(photoID.match(eightdigit)) {
var urlID = (photoID.concat(varUnique));
var newURL = 'http://etncal.staging.wpengine.com/download-your-community-event-photos/?photo=';
location.href=(newURL.concat(urlID));
return false;
} else {
alert('Please enter the eight digit number for your photo ID.');
return false;
}
}[/js]
2] 加载图片的页面: etncal.staging.wpengine.com/download-your-community-event-photos/
添加到本页正文的代码:
<div class="clear-mg"></div>
<div class="photo">[js]
displayPhoto();
[/js]</div>
以下 js 文件的链接包含在同一 wordpress 页面的标题中(单击添加媒体右侧的第二个按钮,使用插件添加): etncal.staging.wpengine.com/wp-content/themes/canvas_child/js/photos.js
照片位于此处: etncal.staging.wpengine.com/wp-content/themes/canvas_child/images/community/photos/
【问题讨论】:
-
查看stackoverflow的其他帖子以获得很好的答案查看 stackoverflow.com/a/21891505/3329864
标签: javascript share addthis