ページ種別毎にCSSファイルを呼び分けheader.phpで条件分岐してlinkタグを出し分けるheader.php(略) <?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> (略) カスタムフィールドを利用する省略。 参考条件分岐タグhttp://wpdocs.sourceforge.jp/%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90%E3%82%BF%E3%82%B0 |
|