How add a sharing button on Static pages ?
How add a sharing button on Static pages ?
If I want to add a sharing button (like Facebook or Twitter, Whatsapp, etc....) on entries (articles) I have to add a code like this on entry-default.tpl:
<a href="http://www.facebook.com/sharer.php?u={$ ... :the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="42" height="42"></a>
<a href="http://twitter.com/share?text={$subject ... :post_link}" target="_blank"><img src="/Immagini/twitter.png" border="0" alt="Twitter" width="42" height="42" ></a>
But adding this on Static pages this doesn't work, ad ex. Facebook reports this error:
href should represent a valid URL
and Twitter (a white page).
On Static pages what type of code I have to add ? It have to be different from ({$id|link:post_link}&title={$subject|tag:the_title}") ?
P.S.
Obviously using sharethis or addthis or addtoany buttons works, but I'd like to use my own sharing buttons.
Thank you
<a href="http://www.facebook.com/sharer.php?u={$ ... :the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="42" height="42"></a>
<a href="http://twitter.com/share?text={$subject ... :post_link}" target="_blank"><img src="/Immagini/twitter.png" border="0" alt="Twitter" width="42" height="42" ></a>
But adding this on Static pages this doesn't work, ad ex. Facebook reports this error:
href should represent a valid URL
and Twitter (a white page).
On Static pages what type of code I have to add ? It have to be different from ({$id|link:post_link}&title={$subject|tag:the_title}") ?
P.S.
Obviously using sharethis or addthis or addtoany buttons works, but I'd like to use my own sharing buttons.
Thank you
Re: How add a sharing button on Static pages ?
On the plugin you made last year, I did add a thing on how to make it work on static pages. The same change will work here.
Please see this post: viewtopic.php?f=4&t=144&start=10#p453
Please see this post: viewtopic.php?f=4&t=144&start=10#p453
-
- Posts: 44
- Joined: Wed Feb 20, 2019 7:44 pm
- Location: Rouchovany
- Contact:
Re: How add a sharing button on Static pages ?
Add "Share this:" to template with Awesome font
View this source and copy with .css link to entry-default.tpl
View this source and copy with .css link to entry-default.tpl
Re: How add a sharing button on Static pages ?
Hi, I have tried to modify in:Tongara wrote: ↑Sat Feb 20, 2021 2:19 am On the plugin you made last year, I did add a thing on how to make it work on static pages. The same change will work here.
Please see this post: viewtopic.php?f=4&t=144&start=10#p453
<a href="http://www.facebook.com/sharer.php?u={$ ... :the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="36" height="36"></a>
Then going of mouse on facebook button appears this:
http://www.facebook.com/sharer.php?u={$ ... :the_title}
and Facebook window reports error:
href should represent a valid URL
at contrary of articles where cliking of facebook button appears:
http://www.facebook.com/sharer.php?u=ht ... 0displaced
On Twitter button
<a href="http://twitter.com/share?text={$subject ... :page_link}" target="_blank"><img src="/Immagini/twitter.png" border="0" alt="Twitter" width="36" height="36" ></a>
the page appears completly white
-
- Posts: 44
- Joined: Wed Feb 20, 2019 7:44 pm
- Location: Rouchovany
- Contact:
Re: How add a sharing button on Static pages ?
replace page_link with post_link
Re: How add a sharing button on Static pages ?
Very strange!Panther wrote: ↑Sat Feb 20, 2021 4:26 pmHi, I have tried to modify in:
<a href="http://www.facebook.com/sharer.php?u={$ ... :the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="36" height="36"></a>
Then going of mouse on facebook button appears this:
http://www.facebook.com/sharer.php?u={$ ... :the_title}
and Facebook window reports error:
href should represent a valid URL
at contrary of articles where cliking of facebook button appears:
http://www.facebook.com/sharer.php?u=ht ... 0displaced
On Twitter button
<a href="http://twitter.com/share?text={$subject ... :page_link}" target="_blank"><img src="/Immagini/twitter.png" border="0" alt="Twitter" width="36" height="36" ></a>
the page appears completly white
My code is like so (It uses fontawesome, but ignore that, as it';s not the point):
Code: Select all
<a href="http://www.facebook.com/sharer.php?u={$id|link:page_link}&title={$subject|tag:the_title}" target="_blank">
<i class="fab fa-facebook-square fa-lg"></i></a>
<a href="http://twitter.com/share?text={$subject|tag:the_title}&url={$id|link:page_link}" target="_blank">
<i class="fab fa-twitter-square fa-lg"></i></a>
<a href="whatsapp://send?text={$subject|tag:the_title} {$id|link:page_link}" data-action="share/whatsapp/share" target="_blank">
<i class="fab fa-whatsapp-square fa-lg"></i></a>
<a href="fb-messenger://share/?link={$id|link:page_link}&app_id=IDHERE" target="_blank">
<i class="fab fa-facebook-messenger fa-lg"></i></a>
<a href="http://pinterest.com/pin/create/link/?url={$id|link:page_link}&description={$subject|tag:the_title}" count-layout="horizontal" target="_blank">
<i class="fab fa-pinterest-square fa-lg"></i></a>
<a href="http://www.tumblr.com/share/link?url={$id|link:page_link}" target="_blank">
<i class="fab fa-tumblr-square fa-lg"></i></a>
<a href="https://reddit.com/submit?url={$id|link:page_link}&title={$subject|tag:the_title}" target="_blank">
<i class="fab fa-reddit-square fa-lg"></i></a>
<a href="mailto:?subject={$subject|tag:the_title}&body={$id|link:page_link}" title="{$subject|tag:the_title}">
<i class="fas fa-envelope-square fa-lg"></i></a>
On static pages, page_link is appropriate. post_link is used for blog posts, as shown here:
Code: Select all
<a href="http://www.facebook.com/sharer.php?u={$id|link:post_link}&title={$subject|tag:the_title}" target="_blank">
<i class="fab fa-facebook-square fa-lg"></i></a>
<a href="http://twitter.com/share?text={$subject|tag:the_title}&url={$id|link:post_link}" target="_blank">
<i class="fab fa-twitter-square fa-lg"></i></a>
<a href="whatsapp://send?text={$subject|tag:the_title} {$id|link:post_link}" data-action="share/whatsapp/share" target="_blank">
<i class="fab fa-whatsapp-square fa-lg"></i></a>
<a href="fb-messenger://share/?link={$id|link:post_link}&app_id=IDHERE" target="_blank">
<i class="fab fa-facebook-messenger fa-lg"></i></a>
<a href="http://pinterest.com/pin/create/link/?url={$id|link:post_link}&description={$subject|tag:the_title}" count-layout="horizontal" target="_blank">
<i class="fab fa-pinterest-square fa-lg"></i></a>
<a href="http://www.tumblr.com/share/link?url={$id|link:post_link}" target="_blank">
<i class="fab fa-tumblr-square fa-lg"></i></a>
<a href="https://reddit.com/submit?url={$id|link:post_link}&title={$subject|tag:the_title}" target="_blank">
<i class="fab fa-reddit-square fa-lg"></i></a>
<a href="mailto:?subject={$subject|tag:the_title}&body={$id|link:post_link}" title="{$subject|tag:the_title}">
<i class="fas fa-envelope-square fa-lg"></i></a>
Re: How add a sharing button on Static pages ?
Now it works, this is because I didn't use static.tpl (as you), but I used another file.
I've read again your post to understand where was my error.
Thank you very much to all.
I've read again your post to understand where was my error.
Thank you very much to all.
Re: How add a sharing button on Static pages ?
Ah, glad you got it working!
Re: How add a sharing button on Static pages ?
If this can help you, this works better
http://www.facebook.com/sharer/sharer.php (with this every page is shared well)
than this
http://www.facebook.com/sharer.php
At the end I use this code:
http://www.facebook.com/sharer/sharer.php (with this every page is shared well)
than this
http://www.facebook.com/sharer.php
At the end I use this code:
Code: Select all
<a href="http://www.facebook.com/sharer/sharer.php?u={$id|link:page_link}&title={$subject|tag:the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="36" height="36"></a>
Re: How add a sharing button on Static pages ?
Oh nice, I'm always up for using something better if it turns up, so I appreciate it. I have now updated my code on my blog.Panther wrote: ↑Sat Feb 20, 2021 9:18 pm If this can help you, this works better
http://www.facebook.com/sharer/sharer.php (with this every page is shared well)
than this
http://www.facebook.com/sharer.php
At the end I use this code:
Code: Select all
<a href="http://www.facebook.com/sharer/sharer.php?u={$id|link:page_link}&title={$subject|tag:the_title}" target="_blank"><img src="/Immagini/facebook.png" border="0" alt="Facebook" width="36" height="36"></a>
Glad we could help one another! haha
Who is online
Users browsing this forum: No registered users and 96 guests