Skip to content
This repository was archived by the owner on Mar 10, 2018. It is now read-only.

add_meta_box

kcopper8 edited this page Mar 14, 2015 · 1 revision

http://codex.wordpress.org/Function_Reference/add_meta_box

설명

add_meta_box() 함수는 2.5 버전에서 도입되었다. 플러그인 개발자가 관리자 인터페이스에 meta box 를 추가할 수 있게 해준다.

이 함수는 add_meta_boxes_{post_type} 이나 'dd_meta_boxes' 액션에서 호출되어야 한다. 과거에는 다른 타입을 위한 불필요한 콜백을 트리거링하는 것은 피하는 것이 선호되었다. (????) 이 액션들은 3.0 버전에 소개되었고, 이전 버전에는 admin_init 이 대신에 사용했다.

사용법

<?php
    add_meta_box( $id, $title, $callback, $screen, $context, $priority, $callback-args );
?>

매개변수

$id

(string) (required) 수정 화면 섹션의 HTML 'id' attributes Default: None

$title

(string) (required) 수정 화면 섹션의 제목. 사용자에게 보임. Default: None

$callback

(callback) (required) 수정 화면 섹션의 HTML을 출력하는 함수. 함수 이름은 문자열이나 클래스내에서는 메서드 중 하나를 호출하는 배열 (???). 이 콜백은 두개의 파라메터를 받는다. 첫번째 파라메터는 현재 에디팅되고 있는 포스트나 페이지의 $post 객체이다. 두번째 파라메터는 전체 $metabox 아이템(배열)이다. Callback args 문서를 보라. 아래의 Example 의 두번째 예제를 보라. Default: None

screen

(string) (optional) 수정 화면 섹션을 보여줄 작성 화면의 타입 (예를 들면 'post', 'page', 'dashboard', 'link', 'attachment', 'custom_post_type' custom_post_type 은 커스텀 포스트 타입 slug 이다.) Default: None

Clone this wiki locally