Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-03-02 04:59:42

WebKat
Member
Registered: 2007-01-16
Posts: 301

Pinterest.com Pin-it button?

The buttons for Pinterest.com at present it seems need to be manually coded for each url that you want to add the pin to. It seems like it would be pretty easy to make a plugin that formatted them for you… here is an example of how the button is formatted:

<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fexample.com%2Findex.html" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>

I would just use the txp tag that outputs the url in there, but as you see it does the whole %3A%2F%2F thing for :// and so on, which I can’t replicate with a txp tag (that I know of).



WebKat

Offline

#2 2012-03-02 05:36:04

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Pinterest.com Pin-it button?

As with many other like and bookmark buttons, this one doesn’t need a plugin. If you need an URL, you can just use Textpattern’s normal tags including permlink, section, site_url and so on. E.g.

<a href="http://pinterest.com/pin/create/button/?url=<txp:permlink />" class="pin-it-button" count-layout="horizontal">Pin It</a>

WebKat wrote:

I would just use the txp tag that outputs the url in there, but as you see it does the whole %3A%2F%2F thing for :// and so on, which I can’t replicate with a txp tag (that I know of).

That is just encoding done by Pin it button editor (which you used, didn’t you). It’s to ensure that the resulting URL is valid no matter what the given URL is. Likely, especially in case of Textpattern, you do may not need it, but if you do, you can encode the string with a help of rah_function plugin and urlencode function, i.e. <txp:rah_function call="urlencode"><txp:permlink /></txp:rah_function>.

Offline

#3 2012-03-02 06:15:43

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: Pinterest.com Pin-it button?

Ah, cool, I didn’t realize rah_function did that. I will have to try it out.



WebKat

Offline

#4 2012-03-02 06:46:50

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: Pinterest.com Pin-it button?

Ok, can rah_function remove the <img src=" and the " alt="" /> from this:

<a href="http://pinterest.com/pin/create/button/?url=<txp:permlink />&media=http://example.com<txp:article_image />" class="pin-it-button" count-layout="horizontal">Pin It</a>

which comes out as:

<a href="http://pinterest.com/pin/create/button/?url=http://example.com/Misc/downloadable-things&media=<img src="/images/344.jpg" alt="" />" class="pin-it-button" count-layout="horizontal">Pin It</a>

I also looked at rah_replace but couldn’t figure out how to get it to work because of all the symbols… I tried \ escaping them but it didn’t work.



WebKat

Offline

#5 2012-03-02 07:50:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Pinterest.com Pin-it button?

Instead of article_image, see:

Offline

#6 2012-03-02 16:08:18

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: Pinterest.com Pin-it button?

But I need it to pull the article image for a given page/article… how do I do that with those tags? (thanks for your help!)



WebKat

Offline

#7 2012-03-02 17:35:42

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Pinterest.com Pin-it button?

<a href="http://pinterest.com/pin/create/button/?url=<txp:permlink /><txp:if_article_image>&media=http://example.com<txp:images><txp:image_url  /></txp:images></txp:if_article_image>" class="pin-it-button" count-layout="horizontal">Pin It</a>

Note: Surrounding the <txp:images/> tag with <txp:if_article_images/> will prevent it from acting on all images if there is not assigned image for that article.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#8 2012-03-02 17:48:07

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 335
Website

Re: Pinterest.com Pin-it button?

A tad off topic perhaps, but be aware that when you upload any image / content to Pinterest.com, you automatically grant Pinterest IP rights with worldwide rights for distribution and/or sale. It makes Pinterest a much less attractive option.

Offline

#9 2012-03-02 19:09:31

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: Pinterest.com Pin-it button?

I didn’t know that, but my article images are very small icon-like thiings that would serve most other peopleno use at all…



WebKat

Offline

Board footer

Powered by FluxBB