Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-11-12 16:53:14

Karsten
Member
From: Leiden, Netherlands
Registered: 2011-04-24
Posts: 47
Website

[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

#2 2013-11-12 16:57:19

etc
Developer
Registered: 2010-11-11
Posts: 5,132
Website GitHub

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

#3 2013-11-12 17:01:12

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,064
Website GitHub Mastodon Twitter

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

#4 2013-11-19 18:04:51

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,215
GitHub

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:

forum.textpattern.com/viewtopic.php?pid=275682#p275682

Offline

Board footer

Powered by FluxBB