목차
워드프레스 테마 제작
기본구조
- index.php
<!doctype html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo('charset'); ?>"> <title><?php bloginfo('name'); //현재 보여주는 페이지에 맞는 제목 ?> <?php wp_title('|'); ?></title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); //style.css와 연결 ?>"> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <?php wp_footer(); ?> </body> </html>
함수
글 정보
- 날짜 : get_the_date (http://codex.wordpress.org/Template_Tags/get_the_date)
- 시간 : get_the_time (http://codex.wordpress.org/Template_Tags/get_the_time)
- 작성자 : the_author (http://codex.wordpress.org/Function_Reference/the_author)
- 카테고리 : the_category (http://codex.wordpress.org/Function_Reference/the_category)
- 태그 : the_tags (http://codex.wordpress.org/Function_Reference/the_tags)
- 글요약 : the_excerpt()
<?php if ( is_home() || is_category() || is_tag() ) { the_excerpt(); } else { the_content(); } ?>
이렇게 하면 첫화면 등에서는 요약글이 나오고, 포스트 제목을 클릭하면 포스트 내용 전체가 나온다. Conditional Tag 참조
functions.php
기능의 사용 여부를 정하거나 여러 설정을 하는 파일임
<?php // Thumbnails add_theme_support( 'post-thumbnails' ); ?>
같이 보기
http://www.cmsfactory.net/node/10237