코멘트 타입 구분 나열
[ Plugin / Sort Comment Type / Leave Comment ]
- 메인 화면에는 코멘트 수와 트랙백 수를 합친 코멘트 수를 표기함. (따로 나누고 싶은 경우 Trackping Separator 플러그인을 참고
- 코멘트 타입 - 디비에 저장되는 타입명
- 트랙백 - trackback
- 핑백 - pingback
- 일반 코멘트 - 없음
- 관리자 코멘트 - 없음
- 비밀 코멘트 (Whisper 플러그인 사용할 때) - whisper:숫자
- 타입 구분할 때
간단하게
<?php if (get_comment_type() == "pingback") {어쩌구;} ?>- 또 다른 방법
<?php global $comment; /* 디비에 저장되는 코멘트 타입명에 whisper라는 글자가 있는지 확인해봄.*/ if (stristr($comment->comment_type,'whisper')) {어쩌구;} 혹은 if (preg_match('|whisper|', $comment->comment_type)) {어쩌구;} ?> - 위를 함수로 만듦
function k2_comment_type_detection($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback', $secrettxt = 'Secret') { global $comment; if (preg_match('|trackback|', $comment->comment_type)) return $trackbacktxt; elseif (preg_match('|pingback|', $comment->comment_type)) return $pingbacktxt; elseif (preg_match('|whisper|', $comment->comment_type)) return $secrettxt; else return $commenttxt; }- 사용시 :
<?php if (k2_comment_type_detection() == "Secret") {어쩌구;} ?>
- 사용시 :
- 쓴 사람에 따른 코멘트 구분
<?php $isByAuthor = false; if($comment->comment_author_email == '이메일@주소.com') { $isByAuthor = true; } ?>- 사용시 :
<?php if ($isByAuthor ) {어쩌구;} ?>
- 사용시 :
Categories : Wordpress
Search
Recent Changes
Groups
Related pages
- Feed Filter
- Jump Page Link with page name Plugin
- Modifying Table of Contents Plugin for Webstandard
- Plugin
- Pmwiki Comment Plugin for Diary Page
- Polyglot Plugin for WAI
- Simple Code Escape
- Star Rating Plugin for PNG-24 Alpha Transparency
- Subscribe to Comments
- Title Plugins for WAI and Convenience
- Xspf Player 비교와 임시 수정
- 구글 스프레드 시트를 위키에 가져오기
- 위키 액션에 권한주기
- 철저하게 웹표준을 지키는 방법
- 코멘트 Allow Tags
- 토글 플러그인