You are here:  » Social Sharing


Social Sharing

Submitted by twdesigns on Mon, 2018-03-19 09:02 in

Greetings David,

I looked but only found a topic that I started 7 years ago which I think may be dated a tad... :)

Can you advise me how to get the following to work with the plugin. It works with the standalone version just fine.

{code saved}

Submitted by support on Mon, 2018-03-19 09:25

Hi,

Try something like this to get started - edit the plugin file pto_product.php and look for the following code at line 490:

    $html_product = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$html_product);

...and REPLACE with:

    $url = urlencode("http".(isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]?"s":"")."://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
    $social = "
      <a target='_blank' href='https://www.facebook.com/sharer/sharer.php?u=".$url."&amp;t=".urlencode($product->name)."'>Facebook</a><br />
      <a target='_blank' href='https://twitter.com/share?url=".$url."&amp;text=".urlencode($product->name)."'>Twitter</a><br />
      <a target='_blank' href='https://plus.google.com/share?url=".$url."&amp;t=".urlencode($product->name)."'>Google+</a><br />
    ";
    if ($product->image_url)
    {
      $social .= "
      <a target='_blank' href='http://pinterest.com/pin/create/button/?url=".$url."&amp;media=".urlencode($product->image_url)."&amp;description=".urlencode($product->name)."'>Pintrest</a>
      ";
    }
    $html_product = str_replace("%SOCIAL%",$social,$html_product);
    $html_product = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$html_product);

And then add where required to your Product / Main template (wp-admin > Settings > PriceTapestry.org) for example;

<p>%SOCIAL%</p>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Mon, 2018-03-19 20:36

Where else would this code be? I checked my PTO file and one from the zip but I don't have a string like that.

I dumbed it down to searching for $html_product with no results still.

Thanks!

Tommy

Submitted by support on Mon, 2018-03-19 20:49

Hello Tommy,

My apologies, it's file pto_product.php - corrected above...

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Tue, 2018-03-20 03:00

You my friend are still the best support for any product I've ever purchased. I don't know how you maintain the same level of performance over the years but you have once again fixed my issue.

Thank you!

Tommy