Hello, everyone. I'm trying to move a lot of content that was embedded into a CMS into a functions file that ties into hooks. Everything's going pretty good except for my attempt at getting the below function to work.
Essentially, It's inserting an area with some social networking buttons. The Pinterest button uses JavaScript and my quotation marks are causing problems. I tried escaping, I tried switching to apostrophes, etc... and was able to get some things to work and others not.
Below is an echo with the raw HTML code without any of the things I've tried so you have a clear picture:
Code:
echo '<br /><div style="float:left;clear:left;height:35px;width:60px;"><a href="javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)})());"><img class="aligncenter" src="http://www.mysite.com/wp-content/uploads/2011/09/pinit.jpg" alt="Pin It" /></a></div><div style="float:left;clear:right;"><iframe src="//www.facebook.com/plugins/like.php?href='.the_permalink().'&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font=arial&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:35px;" allowTransparency="true"></iframe></div><br /><br /></div>';
Just in case you're wondering, the error does not lie directly with the '.the_permalink.' part of the script as I did try removing that.
So can anyone tell me what to replace with apostrophes, what to escape with a backslash, etc...?
I really appreciate the help.