简体   繁体   中英

AddThis need to share custom url generated by js

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!

  1. Go to this page: etncal.staging.wpengine.com/community-event-photos/
  2. Enter ID# 09070073, click Get Photo button
  3. New page loads and the url will read: etncal.staging.wpengine.com/download-your-community-event-photos/?photo=090700731381779074495
  4. A parameter has been passed to url and the photo code entered is the first 8 digits
  5. 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.

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