Title: Template Map
Author: Jon Christopher
Published: <strong>2014년 7월 18일</strong>
Last modified: 2022년 2월 10일

---

플러그인 검색

![](https://ps.w.org/template-map/assets/banner-772x250.jpg?rev=951721)

이 플러그인은 **최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다**. 워드프레스의
좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 
있을 수 있습니다.

![](https://s.w.org/plugins/geopattern-icon/template-map_d59f6f.svg)

# Template Map

 작성자: [Jon Christopher](https://profiles.wordpress.org/jchristopher/)

[다운로드](https://downloads.wordpress.org/plugin/template-map.1.0.1.zip)

 * [세부사항](https://ko.wordpress.org/plugins/template-map/#description)
 * [평가](https://ko.wordpress.org/plugins/template-map/#reviews)
 *  [설치](https://ko.wordpress.org/plugins/template-map/#installation)
 * [개발](https://ko.wordpress.org/plugins/template-map/#developers)

 [지원](https://wordpress.org/support/plugin/template-map/)

## 설명

Template Map is a utility plugin designed to make the creation and management of
navigation elements in your custom theme that much easier. It abstracts the need
to hard code post IDs and the like from your global and header navigation systems(
if you choose to not use Menus) for instance.

#### For Example

Many times you may use something like the following to build your main site navigation:

    ```
    <nav>
      <ul>
        <li>
          <a href="<?php echo get_permalink( 83 ); ?>">About</a>
        </li>
      </ul>
    </nav>
    ```

That works great during initial development, and continues to hold up when you migrate
to production en masse for the first time. But what about when you’re making subsequent
updates and the post IDs in your development environment are different than those
in production? You could take the time to sync the databases each and every time,
but that’s a bit overkill. Here’s where Template Map comes in to play:

    ```
    <nav>
      <ul>
        <li>
          <?php $about_page_id = TemplateMap()->get_id_from_template( 'template-about.php' ); ?>
          <a href="<?php echo get_permalink( $about_page_id ); ?>">About</a>
        </li>
      </ul>
    </nav>
    ```

Template Map allows you to _dynamically_ retreive your desired post ID based on 
the Page Template you told it to use. Page Template filenames rarely (if ever) change,
so it’s the core concept of Template Map’s implementation. Everything works backwards
from here.

Naturally this philosophy assumes your Page Template is used only once, it’s important
to keep that in mind. Modern client sites often use unique Page Templates for the‘
parent’ pages of each site section.

#### Current Site Section

Template Map also makes it easier to determine whether the current page is within
a site ‘section’ which is defined as a top level Page with a unique Page Template
that has any number of child Pages and/or Custom Post Types within it. This is very
useful when trying to set a ‘current’ state in your navigation, for example:

    ```
    <nav>
      <ul>
        <li class="<?php if( TemplateMap()->maybe_in_section( 'template-about.php' ) ) : ?> current<?php endif; ?>">
          <?php $about_page_id = TemplateMap()->get_id_from_template( 'template-about.php' ); ?>
          <a href="<?php echo get_permalink( $about_page_id ); ?>">About</a>
        </li>
      </ul>
    </nav>
    ```

Based on the same principle you can use this utility method to properly orient yourself
when outputting conditional classes contingent on the current page being within 
a ‘secton’ on your site.

## 설치

 1. Upload `templatemap` to the `/wp-content/plugins/` directory
 2. 워드프레스의 ‘플러그인’ 메뉴에서 플러그인을 활성화하세요.
 3. Replace calls to `get_permalink( 83 )` with `get_permalink( TemplateMap()->get_id_from_template('
    template-about.php' ) )` where `template-about.php` is the Page you wish to link

## FAQ

### How do I define Custom Post Types within a section?

There’s a filter for that. `template_map_post_types` accepts two parameters, the
second of which is the Page Template filename in question. You can conditionally
return an array of CPT names that will be utilized when checking to see whether 
the current page is within the section in question.

## 후기

이 플러그인에 대한 평가가 없습니다.

## 기여자 & 개발자

“Template Map”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

 *   [ Jon Christopher ](https://profiles.wordpress.org/jchristopher/)

[자국어로 “Template Map”(을)를 번역하세요.](https://translate.wordpress.org/projects/wp-plugins/template-map)

### 개발에 관심이 있으십니까?

[코드 탐색하기](https://plugins.trac.wordpress.org/browser/template-map/)는, [SVN 저장소](https://plugins.svn.wordpress.org/template-map/)
를 확인하시거나, [개발 기록](https://plugins.trac.wordpress.org/log/template-map/)
을 [RSS](https://plugins.trac.wordpress.org/log/template-map/?limit=100&mode=stop_on_copy&format=rss)
로 구독하세요.

## 변경이력

#### 1.0.1

 * When using maybe_in_section you can pass a 2nd parameter to force a parent ID

#### 1.0

 * 초기 릴리즈

## 기초

 *  버전 **1.0.1**
 *  최근 업데이트: **4년 전**
 *  활성화된 설치 **10+**
 *  워드프레스 버전 ** 3.9 또는 그 이상 **
 *  다음까지 시험됨: **5.9.0**
 *  언어
 * [English (US)](https://wordpress.org/plugins/template-map/)
 * 태그:
 * [link](https://ko.wordpress.org/plugins/tags/link/)[template](https://ko.wordpress.org/plugins/tags/template/)
 *  [고급 보기](https://ko.wordpress.org/plugins/template-map/advanced/)

## 평점

아직 제출된 리뷰가 없습니다.

[Your review](https://wordpress.org/support/plugin/template-map/reviews/#new-post)

[모든  리뷰 보기](https://wordpress.org/support/plugin/template-map/reviews/)

## 기여자

 *   [ Jon Christopher ](https://profiles.wordpress.org/jchristopher/)

## 지원

할 말 있으신가요? 도움이 필요하신가요?

 [지원 포럼 보기](https://wordpress.org/support/plugin/template-map/)

## 기부

이 플러그인이 발전하도록 도우시겠습니까?

 [ 이 플러그인에 기부하기 ](http://mondaybynoon.com/donate/)