Loading [MathJax]/jax/output/HTML-CSS/config.js

워드프레스 테마를 준비해보자

IT/Wordpress 2024. 9. 21. 00:26

워드프레스 테마 준비하기

 

1. wp-content 하위에 폴더 생성 후, function.php, style.css, index.php 생성하기

2. function.php 내부는 비우고, styles.css 는 다음 코드를 추가한다.

/*
Theme Name: My Custom Theme
Theme URI: http://example.com
Author: Your Name
Author URI: http://example.com
Description: A custom theme for my WordPress site.
Version: 1.0
*/

3. index.php 에서 다음 코드를 추가한다.

<?php
// 기본 테마 템플릿 파일
get_header(); // 헤더 호출

if ( have_posts() ) :
    while ( have_posts() ) : the_post();
        the_title('<h1>', '</h1>');
        the_content();
    endwhile;
else :
    echo '<p>No posts found</p>';
endif;

get_footer(); // 푸터 호출
?>

4. 워드프레스 어드민 페이지의 테마 선택 화면으로 이동한다. 

5. 테마 선택 목록에서 2번에서 추가한 테마 이름를 활성화 한다.

 

 

테마 기본 구성을 알아 봤다.