그들은 Filters, Actions 그것을 달성하고 그들로 매춘된다. 귀하의 경우에는
- (사본)에서 the_content
필터 ..
예 :
add_filter('the_content', 'my_the_content_filter', 20);
/**
* Add a icon to the beginning of every post page.
*
* @uses is_single()
*/
function my_the_content_filter($content) {
if (is_single())
// Add image to the beginning of each page
$content = sprintf(
'<img class="post-icon" src="%s/images/post_icon.png" alt="Post icon" title=""/>%s',
get_bloginfo('stylesheet_directory'),
$content
);
// Returns the content.
return $content;
}
더 간단한 이해 예 :
add_filter('the_content', 'add_something_to_content_filter', 20);
function add_something_to_content_filter($content) {
$original_content = $content ; // preserve the original ...
$add_before_content = ' This will be added before the content.. ' ;
$add_after_content = ' This will be added after the content.. ' ;
$content = $add_pre_content . $original_content . $add_sur_content ;
// Returns the content.
return $content;
}
행동이 예를 볼 수있는, 귀하의 functions.php에 넣어
이것은 실제로 wordpress를 이해하고, 플러그인을 작성하기 시작하는 가장 중요한 단계. 정말로 관심이 있으시면 위의 링크를 읽으십시오.
또한, ...
네 덕분에 방금 언급 한 플러그인 파일을 열고 Filters 및 Actions을 찾아! WordPress에 매우 새롭기 때문에, 나는 플러그인을 만드는 것에서 벗어난 방법이지만 이것은 매우 도움이된다! 너 락. –
좋습니다. 플러그인 작성과 행운을 비네. 답변이 도움이 되었다면 동의 해주십시오. (점수 아래 작은 녹색 "v") –