Title: Ambrosite Body Class Enhanced
Author: ambrosite
Published: <strong>2010년 4월 26일</strong>
Last modified: 2011년 7월 3일

---

플러그인 검색

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

![](https://s.w.org/plugins/geopattern-icon/ambrosite-body-class-enhanced.svg)

# Ambrosite Body Class Enhanced

 작성자: [ambrosite](https://profiles.wordpress.org/ambrosite/)

[다운로드](https://downloads.wordpress.org/plugin/ambrosite-body-class-enhanced.zip)

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

 [지원](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/)

## 설명

When activated, this plugin causes the body_class template tag to output five additional
classes.

On single posts (is_single) :
 postname-[permalink slug] single-[category slug] 
parent-[parent category slug] (all parent and grandparent categories in a hierarchy
of any depth)

On pages (is_page) :
 pagename-[permalink slug]

On category archives (is_archive and is_category) :
 parent-category-[parent category
slug] (all parent and grandparent categories in a hierarchy of any depth)

#### Custom Taxonomies

As of version 1.3, the plugin now supports custom hierarchical taxonomies. The new
body classes take the following form:

On single posts (is_single) :
 single-[taxonomy]-[term slug] parent-[taxonomy]-[
parent term slug] (all parent and grandparent terms in a hierarchy of any depth)

On taxonomy archives (is_archive and is_tax) :
 parent-term-[parent term slug] (
all parent and grandparent terms in a hierarchy of any depth)

For single posts, the taxonomy name is included in the class name, because I felt
it was important to be able to distinguish between taxonomies in cases where a post
is assigned to more than one custom taxonomy, and when the same term might appear
in two or more taxonomies. For example, suppose you had a real estate site with 
property listings in New York City, and you had two custom taxonomies defined: City
and State. Then the classes would look like this:

    ```
    single-city-new-york single-state-new-york
    ```

#### Multisite Support

As of version 1.3, the plugin now supports multisite installations. If a multisite
install is detected, the plugin will output the follow additional body class on 
every page of the site:

    ```
    site-[site ID]
    ```

#### Examples

If you have a post titled “Top 10 Decorating Ideas”, in category “Christmas”, with
a parent category of “Holidays” and a grandparent category of “Calendar”, the additional
body classes will be as follows:

    ```
    postname-top-10-decorating-ideas single-christmas parent-holidays parent-calendar
    ```

Why is this useful? Because it enables you to style individual posts and pages, 
as well as entire categories of posts, using only CSS, without having to edit the
template files or create new templates.

Continuing the above example, if I wanted to give all of the posts in the Christmas
category a green heading (to give them some extra holiday cheer), I could use a 
CSS selector like this:

    ```
    body.single-christmas h1 {
        color: green;
    }
    ```

Going further, suppose I want to attach a background image of a Christmas tree ONLY
to the “Top 10 Decorating Ideas” post:

    ```
    body.postname-top-10-decorating-ideas div.post {
        background: url('images/xmas_tree.gif') no-repeat left top;
    }
    ```

What if I want all posts categorized under Holidays (Christmas, Thanksgiving, Easter,
whatever) to have a sidebar with a gold border?

    ```
    body.parent-holidays div#sidebar,  /* all posts assigned to a subcategory of Holidays */
    body.single-holidays div#sidebar { /* any posts assigned directly to the Holidays category */
        border: solid 2px gold;
    }
    ```

These are just a few examples. If you are experienced in writing CSS selectors, 
you will find many more uses for the new body classes. For further discussion, check
this support forum thread: https://wordpress.org/support/topic/393942

## 설치

 * Upload ‘ambrosite-body-class.php’ to the ‘/wp-content/plugins/’ directory.
 * Activate the plugin through the ‘Plugins’ menu in WordPress.
 * Verify your theme has the body_class function on the body element in header.php,
   as explained in the WordPress Codex: https://codex.wordpress.org/Template_Tags/
   body_class

## FAQ

  The body_class template tag is already outputting the post and page IDs. Aren’t
the slugs redundant?

Yes, the post IDs can be used in CSS selectors. However, the slugs are much easier
to remember and use. They will also make the CSS file a lot more readable when you
come back to it a month or a year later.

  The post_class template tag is already outputting the category slug. Isn’t it 
redundant to put it on the body as well?

Putting the category slug on the body makes it possible to target elements outside
of the post div. For example, if you wanted to style the sidebar on a per-category
basis (e.g. change it’s width for all posts in a certain category, or even hide 
it completely), you could do it using the body class, but not the post class.

## 후기

![](https://secure.gravatar.com/avatar/c32b444916b40790b1a2b6bf67e0dfc0bd0f8a416df5192cf6b31765ab46af7a?
s=60&d=retro&r=g)

### 󠀁[Seems to work on 5.5](https://wordpress.org/support/topic/seems-to-work-on-5-5/)󠁿

 [bhkh](https://profiles.wordpress.org/bhkh/) 2020년 8월 20일

Works fine on WP 5.5. Thanks! It does what it says it does.

![](https://secure.gravatar.com/avatar/b95ec1df60ee7406c30b43367a00969e4f2a498ff04da25ef094266ba2803a11?
s=60&d=retro&r=g)

### 󠀁[Still great](https://wordpress.org/support/topic/still-great-3/)󠁿

 [](https://profiles.wordpress.org/eric3d/) 2017년 10월 3일

Still works fine. Please release an updated version so it's not flagged as obsolete.

![](https://secure.gravatar.com/avatar/a78fafaef435f27e85426947f91d5766df100706a895674f5fc19da69e8b3eec?
s=60&d=retro&r=g)

### 󠀁[6 years old and still works like a champ](https://wordpress.org/support/topic/6-years-old-and-still-works-like-a-champ/)󠁿

 [jvwx](https://profiles.wordpress.org/enfueggo/) 2017년 5월 12일

Thanks!

![](https://secure.gravatar.com/avatar/0043437aa32c5824aa32678709acc7f01a202e10f7815cf8f1e9d7b5717d9e3f?
s=60&d=retro&r=g)

### 󠀁[Still works perfect for me](https://wordpress.org/support/topic/still-works-perfect-for-me/)󠁿

 [michaelscheurer](https://profiles.wordpress.org/michaelscheurer/) 2017년 3월 18
일

Still works perfect for me

 [ 모든 5 평가 읽기 ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/)

## 기여자 & 개발자

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

기여자

 *   [ ambrosite ](https://profiles.wordpress.org/ambrosite/)

[자국어로 “Ambrosite Body Class Enhanced”(을)를 번역하세요.](https://translate.wordpress.org/projects/wp-plugins/ambrosite-body-class-enhanced)

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

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

## 변경이력

#### 1.3

 * Added support for custom hierarchical taxonomies.
 * Added multisite support.

#### 1.2

 * Added category archive parent categories.
 * Finds all parent and grandparent categories in a hierarchy of any depth.

#### 1.1

 * Added single parent categories.
 * Added prefix variables for easier customization.

#### 1.0

 * Initial version.

## 기초

 *  버전 **1.3**
 *  최근 업데이트: **15년 전**
 *  활성화된 설치 **200+**
 *  워드프레스 버전 ** 2.8 또는 그 이상 **
 *  다음까지 시험됨: **3.2.1**
 *  언어
 * [English (US)](https://wordpress.org/plugins/ambrosite-body-class-enhanced/)
 * 태그:
 * [body](https://ko.wordpress.org/plugins/tags/body/)[body_class](https://ko.wordpress.org/plugins/tags/body_class/)
   [classes](https://ko.wordpress.org/plugins/tags/classes/)[page](https://ko.wordpress.org/plugins/tags/page/)
   [post](https://ko.wordpress.org/plugins/tags/post/)
 *  [고급 보기](https://ko.wordpress.org/plugins/ambrosite-body-class-enhanced/advanced/)

## 평점

 별 5점 만점에 5점.

 *  [  5/5-별점 후기     ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/?filter=5)
 *  [  0/4-별점 후기     ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/?filter=4)
 *  [  0/3-별점 후기     ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/?filter=3)
 *  [  0/2-별점 후기     ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/?filter=2)
 *  [  0/1-별점 후기     ](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/#new-post)

[모든  리뷰 보기](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/reviews/)

## 기여자

 *   [ ambrosite ](https://profiles.wordpress.org/ambrosite/)

## 지원

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

 [지원 포럼 보기](https://wordpress.org/support/plugin/ambrosite-body-class-enhanced/)

## 기부

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

 [ 이 플러그인에 기부하기 ](http://www.ambrosite.com/plugins)