WordPress                
            대기열에 포함 된 스타일
        
        
            
    수색…
통사론
- wp_enqueue_style ($ handle, $ src, $ dependency, $ version, $ media);
매개 변수
| 매개 변수 | 세부 | 
|---|---|
| $handle | (String) (필수) 스타일 시트의 고유 이름. | 
| $src | (String) (옵션) 링크 태그의 src 속성 내에서 사용될 스타일 시트의 URL. | 
| $deps | (String) (선택 사항)이 스타일 시트가 의존하는 스타일 시트 핸들 배열입니다. | 
| $ver | (String) (선택 사항) 스타일 시트의 스타일 시트 버전을 지정하는 문자열. | 
| $media | (String) (선택 사항)이 스타일 시트가 작성된 미디어입니다. 예 : '모두', '인쇄', '화면'등 | 
종속성으로 다른 CSS 파일과 함께 내부 CSS 파일 포함
function themeSlug_enqueue_scripts() {
    wp_enqueue_style( 'themeSlug-reset', get_template_directory_uri() .'/css/reset.css', '1.0.0' );
    wp_enqueue_style( 'themeSlug-style', get_template_directory_uri() .'/style.css', 'themeSlug-reset', '1.0.0');
}
add_action('wp_enqueue_scripts', 'themeSlug_enqueue_scripts');
내부 CSS 파일 포함
 이 경우 style.css 는 테마 폴더의 루트에 있습니다. 
function themeSlug_enqueue_scripts() {
    wp_enqueue_style( 'themeSlug-style', get_template_directory_uri() .'/style.css', '1.0.0');
}
add_action('wp_enqueue_scripts', 'themeSlug_enqueue_scripts');
외부 CSS 파일 포함
이 예제에서는 font awesome icon font를 포함하고자합니다.
function themeSlug_enqueue_scripts() {
    wp_enqueue_style( 'font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css');
}
add_action('wp_enqueue_scripts', 'themeSlug_enqueue_scripts');
Internet Explorer 전용 스타일 시트 인큐
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' );
/**
 * Enqueue styles (or scripts) conditionally.
 *
 * Load stylesheets (or scripts) specifically for IE. IE10 and above does
 * not support conditional comments in standards mode.
 *
 * @link https://gist.github.com/wpscholar/4947518
 * @link https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
 */
function enqueue_my_styles_and_scripts() {
    // Internet Explorer specific stylesheet.
    wp_enqueue_style( 'themename-ie', get_stylesheet_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' );
    wp_style_add_data( 'themename-ie', 'conditional', 'lte IE 9' );
    // Internet Explorer 7 specific stylesheet.
    wp_enqueue_style( 'themename-ie7', get_stylesheet_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' );
    wp_style_add_data( 'themename-ie7', 'conditional', 'lt IE 8' );
}
플러그인 클래스 용 내부 CSS 파일 포함
class My_Plugin() {
  function __construct() {
    add_action( 'wp_enqueue_scripts', array( $this, 'init_fe_assets' ) );
  }
  public function init_fe_assests() {
    wp_enqueue_style( 'my-plugin', plugin_dir_url( __FILE__ ) . 'assets/css/frontend/plugin.css', array(), '0.0.1', true );
  }
}
new My_Plugin();
        대체 스타일 시트 추가
    <?php wp_enqueue_style('theme-five', get_template_directory_uri() . '/path/to/additional/css'); 
wp_style_add_data('theme-five', 'alt', true); 
wp_style_add_data('theme-five', 'title', __('theme-five.css', 'your-theme-name')); ?>
Modified text is an extract of the original Stack Overflow Documentation
        아래 라이선스 CC BY-SA 3.0
        와 제휴하지 않음 Stack Overflow