I'm trying to create a shortcode to insert the Pinterest button with variables manually in posts. This is the code I've arrived at after reading various posts and grabbing the code from Pinterest. I haven't tested it yet. I wondered whether someone would kindly check for any obvious errors or problems?
Secondly, I wondered if in place of the 'url' variable the url / permalink of the post can be grabbed automatically? So this is the code I have.
Any thoughts / comments?...
function mypinfunction( $atts ) {
extract( shortcode_atts( array(
'url' => ''
'img' => ''
'description' => ''
), $atts ) );
return '<span class="lowpin"><a data-pin-config="none"
href="//pinterest.com/pin/create/button/
url='.url.'&media='.img.'&description='.description.'" data-pin-do="buttonPin" >
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a></span>'
add_shortcode('skipspin', 'mypinfunction');
The short code to insert would be [skipspin url="http://example.com" img="http://example.com/image.jpg" description="some words here"]