Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[howto] Add a Pinterest pin this page button to your articles
I’m new at Pinterest and I noticed the standard widgets they offer are only pre-programmed pin buttons, rather than dynamically generated pin buttons that allow you to pin a specific article from your site. Hence I did the following: I combined their pin-button code with a bit of TXP:
<txp:if_individual_article>
<a href="//www.pinterest.com/pin/create/button/?url=<txp:permlink />&media=http://www.YOUR-PAGE.com/images/<txp:php> echo htmlspecialchars($GLOBALS['thisarticle']['article_image']); </txp:php>.png&description=<txp:title />" data-pin-do="buttonPin" data-pin-config="above"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" /></a>
</txp:if_individual_article>
This generates a button that allows users to pin a specific article, uses the article_image (.png change if you like) and the article_title.
I’m sure there is an easier way to echo the url for your article image, but this works for me.
:)
{Edited to add some Textile for code display. – Uli}
Last edited by uli (2013-11-12 19:52:24)
Offline
Re: [howto] Add a Pinterest pin this page button to your articles
Karsten wrote:
I’m sure there is an easier way to echo the url for your article image, but this works for me.
If I remember well, it was <txp:custom_field name="article_image" />
:)
Offline
Re: [howto] Add a Pinterest pin this page button to your articles
Or simpler <txp:article_image />
:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [howto] Add a Pinterest pin this page button to your articles
You’re both right. It depends on the image URL format. Here’s the scoop from Stef:
Offline