title: How to use the_permalink() on wordpress when it's wrapped with ' or "
body: <p>I have a code that wraps every image on posts with an external div (for share buttons when hovering on images). 
  The thing is, when I want to write the_permalink(); in the function.php, it's wrapped inside a ' or a " in the a href tags. </p>
  
  <p>That causes share links look like this:</p>
  
  <p><a href="https://plus.google.com/share?url=%3C?php%20the_permalink();%20?%3E" rel="nofollow">https://plus.google.com/share?url=%3C?php%20the_permalink();%20?%3E</a></p>
  
  <p>This is the code in function.php:</p>
  
  <pre><code>function breezer_addDivToImage( $content ) {
     // A regular expression of what to look for.
     $pattern = '/(&lt;img([^&gt;]*)&gt;)/i';
     // What to replace it with. $1 refers to the content in the first 'capture group', in parentheses above
     $the_url = the_permalink();
     $replacement = '&lt;div class="imgWrap"&gt; 
                          $1
                          &lt;div class="imgDescription"&gt;
                                              &lt;div class="theShareLinks"&gt;
                                                  &lt;img src="http://localhost/mySite/wp-content/uploads/2014/08/dfc2.png" /&gt;
                                                  &lt;a href="http://twitter.com/share?text=&amp;url=&lt;?php the_permalink(); ?&gt;" class="img-twitter" title="Share on Twitter"&gt;&lt;/a&gt;
                                                  &lt;a href="http://www.facebook.com/sharer.php?u=&lt;?php the_permalink(); ?&gt;?" title="Share on Facebook" onclick="window.open(this.href, \'newwin\', \'width=500, height=200\'); return false;" class="img-facebook"&gt;&lt;/a&gt;
                                                  &lt;a href="https://plus.google.com/share?url=&lt;?php the_permalink(); ?&gt;" class="img-google" title="Share on Google"&gt;&lt;/a&gt;
                                              &lt;/div&gt;
                                          &lt;/div&gt;
                      &lt;/div&gt;';
  
     // run preg_replace() on the $content
     $content = preg_replace( $pattern, $replacement, $content );
  
     // return the processed content
     return $content;
  }
  
  add_filter( 'the_content', 'breezer_addDivToImage' );
  </code></pre>
  
  <p>These are the lines from the code above^ that are wrapped in the " " :</p>
  
  <pre><code>&lt;a href="http://twitter.com/share?text=&amp;url=&lt;?php the_permalink(); ?&gt;" class="img-twitter" title="Share on Twitter"&gt;&lt;/a&gt;
  &lt;a href="http://www.facebook.com/sharer.php?u=&lt;?php the_permalink(); ?&gt;?" title="Share on Facebook" onclick="window.open(this.href, \'newwin\', \'width=500, height=200\'); return false;" class="img-facebook"&gt;&lt;/a&gt;
  &lt;a href="https://plus.google.com/share?url=&lt;?php the_permalink(); ?&gt;" class="img-google" title="Share on Google"&gt;&lt;/a&gt;
  </code></pre>