wordcamp seoul 2012 - wordpress custom post type
Post on 13-May-2015
1.678 Views
Preview:
DESCRIPTION
TRANSCRIPT
Custom Post Type
By 임민형 @ssamturessamture@gmail.com
http://ssamture.net
WordCamp Seoul 2012Seoul, South Korea - May 26Track3 – 14:10
미리보기
• Post 와 Page• Custom Post Type • Custom Meta Box• Custom Filelds• Filter 를 이용한 Cutom Fileds 출력• Custom Post Type 을 위한 테마 템플릿• Custom Post list( 관리자패널 )• Custom Taxonomies
WordCamp Seoul 2012 @ssamture
POST 와 PAGE
• content 저장
POST 와 PAGE
• POST- title, content, tag, category- 시간- 포멧
WordCamp Seoul 2012 @ssamture
POST 와 PAGE
WordCamp Seoul 2012 @ssamture
POST 와 PAGE
• PAGE- title, content- 상위 page- 템플릿 적용
WordCamp Seoul 2012 @ssamture
POST 와 PAGE
WordCamp Seoul 2012 @ssamture
Custom Post Type
• post type• 플러그인 생성• register_post_type
Custom Post Type
• 반복되는 메타정보를 입력할 때- 갤러리 ( 촬영날짜 , 촬영장소 등 )- 쇼핑몰 ( 제품가격 , 제품색상 등 )
• 특정 UI 를 적용할 때
WordCamp Seoul 2012 @ssamture
Custom Post Type
• 모든 내용은 posts 테이블에 저장- post, page, attachment, menu 등
WordCamp Seoul 2012 @ssamture
Custom Post Type
• 플러그인 생성
WordCamp Seoul 2012 @ssamture
Custom Post Type
• register_post_type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
• 클래스 화- 다른 플러그인과 함수명 충돌 예방
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
• 고유주소 업데이트로 해결
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
• 다양한 라벨 속성
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
Custom Post Type
• supports
WordCamp Seoul 2012 @ssamture
Custom Post Type
WordCamp Seoul 2012 @ssamture
post_formats
page-attributes
thumbnail
Custom Post Type
WordCamp Seoul 2012 @ssamture
trackbacks
custom-fileds
comments
author
Custom Post Type
WordCamp Seoul 2012 @ssamture
supports 추가 후
supports 추가 전
supports 제거
Custom Meta Box(Custom Field)
• add_meta_box
Custom Meta Box
• 메타 데이터• 포스트에 별도의 새로운 정보를 부여
WordCamp Seoul 2012 @ssamture
Custom Meta Box
• add_meta_boxes action
• add_meta_box function
WordCamp Seoul 2012 @ssamture
Custom Meta Box
WordCamp Seoul 2012 @ssamture
meta box title
Custom Meta Box
WordCamp Seoul 2012 @ssamture
meta box 입력 폼
Custom Meta Box
WordCamp Seoul 2012 @ssamture
meta box 입력 폼
Custom Meta Box
WordCamp Seoul 2012 @ssamture
meta 정보 입력
저장
Custom Meta Box
WordCamp Seoul 2012 @ssamture
저장 되지 않음
Custom Meta Box
WordCamp Seoul 2012 @ssamture
Custom Meta Box
WordCamp Seoul 2012 @ssamture
Meta 출력
• get_post_meta• ‘the_content’ filter 활용• 테마
메타 출력
• Filter 를 이용하여 출력• 테마 파일에서 출력
WordCamp Seoul 2012 @ssamture
메타 출력 (filter 이용 )
• `the_content` filter
WordCamp Seoul 2012 @ssamture
메타 출력 (filter 이용 )
WordCamp Seoul 2012 @ssamture
메타 출력 ( 테마에서 )
WordCamp Seoul 2012 @ssamture
메타 출력 ( 테마에서 )
• single-{post_type}.php
WordCamp Seoul 2012 @ssamture
메타 출력
WordCamp Seoul 2012 @ssamture
메타 출력 ( 테마에서 )
WordCamp Seoul 2012 @ssamture
목록 커스터마이징 ( 관리자 화면 )
• manage_edit-{post_type}_column• manage_{post_type}_posts_custom_column
목록 커스터마이징 ( 관리자 화면 )
• 리스트
WordCamp Seoul 2012 @ssamture
목록 커스터마이징 ( 관리자 화면 )
• manage_edit-{post_type}_columns
WordCamp Seoul 2012 @ssamture
목록 커스터마이징 ( 관리자 화면 )
WordCamp Seoul 2012 @ssamture
메타 출력
• manage_{post_type}_posts_custom_column
WordCamp Seoul 2012 @ssamture
메타 출력
WordCamp Seoul 2012 @ssamture
메타 출력
WordCamp Seoul 2012 @ssamture
목록 커스터마이징 ( 관리자 화면 )
WordCamp Seoul 2012 @ssamture
목록 커스터마이징 ( 관리자 화면 )
WordCamp Seoul 2012 @ssamture
텍소노미 추가
• register_taxonomy
텍소노미 추가
• custom post type 을 위한 카테고리 추가
WordCamp Seoul 2012 @ssamture
텍소노미 추가
• register_taxonomy($taxonomy, $object_type, $args)
WordCamp Seoul 2012 @ssamture
텍소노미 추가
WordCamp Seoul 2012 @ssamture
Parent Post in a Metabox
• add_meta_box
Parent Post in a Metabox
• add_meta_box
WordCamp Seoul 2012 @ssamture
Parent Post in a Metabox
• add_meta_box
WordCamp Seoul 2012 @ssamture
Parent Post in a Metabox
WordCamp Seoul 2012 @ssamture
Querying
• WP_Query
메타 출력
WordCamp Seoul 2012 @ssamture
메타 출력
WordCamp Seoul 2012 @ssamture
끝 , 감사합니다 .^^
top related