4. ACTION
동작
add_action(hook, function);
(http://codex.wordpress.org/Plugin_API/Action_Reference)
5. FILTER
변형 및 반환
add_filter(hook, function);
(http://codex.wordpress.org/Plugin_API/Filter_Reference)
6. Action(Filter) 사용
add_action[add_filter](
‘hook_name’, *워드프레스가 제공하는 action hook의 이름
*실제 action을 취할 자신이 작성한 혹은
‘function_name’, 워드프레스에서 제공하는 함수의 이름
해당 action에서의 실행 우선 순위(기본값 10).
[priority], 낮은 숫자일수록 먼저 실행됨.
[accepted_args]실행 함수에서 사용할 인자의 개수(기본값 1).
);
add_action(‘wp_head’, ‘wp_print_head_scripts’);
add_action(‘wp_head’, ‘wp_print_head_scripts’, 10, 1);
10. Pluggable Functions
Action, Hook 와는 다르게 pluggable 함수
들은 워드프레스의 함수 자체를 플러그인에
서 간섭이 아닌 대체를 할 수 있다.
워드프레스 자체적으로 일정부분의 hack을
가능하도록 해 둔 셈.
11. 대표적인 Pluggable 함수
function wp_set_current_user($id, $name = '') {}
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {}
function wp_authenticate($username, $password) {}
function check_admin_referer($action = -1, $query_arg = '_wpnonce') {}
function wp_redirect($location, $status = 302) {} 사용자 인식
function wp_notify_postauthor( $comment_id, $comment_type = '' ) {} 메일 발송
function wp_salt($scheme = 'auth') {} 보안관련
function wp_generate_password( $length = 12, $special_chars = true, 아바타
$extra_special_chars = false ) {}
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {}
function wp_text_diff( $left_string, $right_string, $args = null ) {}
12. Classes API
현재 워드프레스의 핵심 코어 기능들이 하나
둘 API의 형태를 갖추어 가고 있으며, 플러
그인 개발자들은 손쉽게 해당 API를 이용해
다양한 기능들을 손쉽게 구현할 수 있다.
13. class _WP_Editors
(wp-includes/class-wp-editor.php)
워드프레스의 에디터(TinyMCE 포함)를 손쉽게
구현하여 활용할 수 있다.
14. class Walker
(wp-includes/class-wp-walker.php)
루핑되는 데이터 출력을 계단형 구조까지도 손쉽
게 – 예: 카테고리 드롭다운, 체크박스 등.
15. class WP_oEmbed
(wp-includes/ class-oembed.php)
다양한 종류의 멀티미디어 자료를 본문에 손 쉽게
넣을 수 있도록 함.
http://www.youtube.com/watch? v=VR2oU8npR7Y
16. class WP_User_Query
(wp-includes/user.php)
class WP_Comment_Query
(wp-includes/ comment.php)
class WP_Meta_Query
(wp-includes/meta.php)
MySQL query문 작성에 자신이 없는 개발자 들도
효율적으로 원하는 custom 정보에 접근 할 수 있
도록 하며, Query 구문과 Filter 사용에 통일성.
20. 워드프레스 관리자 화면
SCREEN
META BOX LIST TABLE
class WP_Screen();
add_meta_box() class WP_List_Table();
모든 관리자 화면
Dashboad wp-admin/includes/ Admin > Posts
wp-admin/includes/ screen.php wp-admin/includes/
dashboard.php class-wp-list-table.php