本文介绍了AddThis需要分享js生成的自定义url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要 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 - 所以没有加载图像的空白页面正在被共享.需要共享具有唯一 url 的页面 &照片.
社区活动照片表单使用两页:
1] 带表单的页面:etncal.staging.wpengine.com/community-event-photos/
添加到此页面正文的代码:
[js]varUnique=new Date().getTime()//永远是唯一的函数 CheckForm() {var photoID = document.photoForm.photoID.value;var numericExpression =/^[0-9]+$/;var八位=/^\d{8}$/;如果(照片ID.匹配(八位数字)){var urlID = (photoID.concat(varUnique));var newURL = 'http://etncal.staging.wpengine.com/download-your-community-event-photos/?photo=';location.href=(newURL.concat(urlID));返回假;} 别的 {alert('请输入您的照片 ID 的八位数字.');返回假;}}[/js]
2] 加载图片的页面:etncal.staging.wpengine.com/download-your-community-event-photos/
添加到此页面正文的代码:
<div class="照片">[js]显示照片();[/js]
链接到以下 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/
解决方案
问题是您将 addthis:url 参数设置为与地址栏不同的值.这是您网页上的代码:
<div addthis:url='http://etncal.staging.wpengine.com/download-your-community-event-photos/' addthis:title='下载您的社区活动照片' class=addthis_toolbox addthis_default_style addthis_32x32_style"><a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a><a class="addthis_button_email"></a>
您需要将 addthis:url 参数设置为照片页面的 URL 或将您的标签设置为照片页面的 URL.
I need the facebook/twitter/email buttons to share the page with the photo loaded. The script for the photo form was written years ago by a colleague that has left and I have concluded that it is something I am not able to customize myself. I have included as much info as I could think of. Thanks!
EDIT: I can provide wp login details for anyone that would like to take a stab at this for me. Very much appreciated!
- Go to this page: etncal.staging.wpengine.com/community-event-photos/
- Enter ID# 09070073, click Get Photo button
- New page loads and the url will read: etncal.staging.wpengine.com/download-your-community-event-photos/?photo=090700731381779074495
- A parameter has been passed to url and the photo code entered is the first 8 digits
- Share this buttons are linking to the page url without parameter - so the blank page without the image loaded is being shared. Need to share page with unique url & photo.
Community Event Photo form uses two pages:
1] Page with form:etncal.staging.wpengine.com/community-event-photos/
Code added to body of this page:
[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] Page that loads image:etncal.staging.wpengine.com/download-your-community-event-photos/
Code added to body of this page:
<div class="clear-mg"></div>
<div class="photo">[js]
displayPhoto();
[/js]</div>
Link to the following js file is included in header of same wordpress page (click on 2nd button to right of Add Media, using a plugin to add):etncal.staging.wpengine.com/wp-content/themes/canvas_child/js/photos.js
PHOTOS ARE LOCATED HERE:etncal.staging.wpengine.com/wp-content/themes/canvas_child/images/community/photos/
解决方案
The problem is that you're setting the addthis:url parameter to a different value from the address bar. Here's the code on your page:
<div addthis:url='http://etncal.staging.wpengine.com/download-your-community-event-photos/' addthis:title='Download Your Community Event Photo ' class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_email"></a>
</div>
You need to set the addthis:url parameter to the URL of the photo page or set your tag to the URL of the photo page.
这篇关于AddThis需要分享js生成的自定义url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!