Using this code below, I added some on-hover share icons for all images of the content. But, now these images are not getting any "Link To" setting from authors. I don't know what is the problem. Can anyone please look at this code below and guide me?
public function
Add_Pin_Button($content){
global $post;
// Get the post urls
$posturl = urlencode(get_permalink());
// Define a pattern to find all images inside the content
$pattern = '/<img(.*?)src="(.*?).(bmp|gif|jpeg|jpg|png)" (.*?) width="(.*?)" height="(.*?)" \/>/i';
// Replace the images with the following div and pin button
$button_div = '<div class="democlass">
<div class="secondclass">
<div class="thirdclass">
<a href="http://ift.tt/OxyLGR' . get_permalink().'&title='.get_the_title().'">
<img src="http://ift.tt/1DkDhoJ" width="45px" />
</a>
</div>
</div>
<div class="disdemo"><img$1src="$2.$3" $4 width="$5" height="$6" /></div> </div>
';
// Replace the images with a containing div with a pin button on the image
$content = preg_replace( $pattern, $button_div, $content );
return $content;
}
And how to add attachment link to all images of the content?
Aucun commentaire:
Enregistrer un commentaire