초보자를 여기에 WordPress에.바로 가기 function.php에서 번역하지 않습니다
나는 현재 내 블로그의 모든 이미지에 FB 공유 버튼을 추가하기 위해 노력하고있어 및 functions.php이 추가되었습니다 : 영구 링크가 아니라는 사실을 제외하고,
function breezer_addDivToImage($content) {
// A regular expression of what to look for.
$pattern = '/(<img([^>]*)>)/i';
// What to replace it with. $1 refers to the content in the first 'capture group', in parentheses above
$replacement = '<div class="myphoto">$1<a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink(); ?>" class="facebook-share-btn fb-" data-fsb-service="facebook" data-href="<?php echo get_permalink(); ?>" rel="nofollow" target="_blank">Share on Facebook</a></div>';
// run preg_replace() on the $content
$content = preg_replace($pattern, $replacement, $content);
// return the processed content
return $content;
}
add_filter('the_content', 'breezer_addDivToImage');
작품 잘 번역 (PHP 공유). 어리석게 간단한 뭔가가 있습니다. 내가 잘못하고 있다는 것을 압니다. 어떤 도움이라도 대단히 감사합니다.
건배!
아 당신이 챔피언 것을 시도! 너무 대단히 감사합니다. – user3340240