* ページ種別毎にCSSファイルを呼び分け [#sf1bb0b7]

** header.phpで条件分岐してlinkタグを出し分ける [#d1f3f819]
*** header.php [#m78077d5]
 (略)
 <?php wp_head(); ?>
 <?php if (is_home()) { ?>
 <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() ?>/style-home.css" type="text/css" media="all" />
 <?php } else if (is_single() && in_category('foo')) { ?>
 <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() ?>/style-single-foo.css" type="text/css" media="all" />
 <?php } else if (is_single() || is_page()) { ?>
 <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() ?>/style-single.css" type="text/css" media="all" />
 <?php } ?>
 </head>
 (略)

** カスタムフィールドを利用する [#x08f8b63]
省略。

** 参考 [#q81fa827]
*** 条件分岐タグ [#s831afd6]
http://wpdocs.sourceforge.jp/%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90%E3%82%BF%E3%82%B0

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS