Skip to content

Instantly share code, notes, and snippets.

@kohki-shikata
Last active January 3, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohki-shikata/8467447 to your computer and use it in GitHub Desktop.
Save kohki-shikata/8467447 to your computer and use it in GitHub Desktop.
**For concrete5Add custom css file in the specified page type.Required css file same named as page type handle, in the template directory.
<?php
$pageType = $c->getCollectionTypeHandle();//ページタイプのハンドルを取得
$pageTypeCss = $this->getThemePath() . "/css/" . $pageType . ".css";//そのハンドルの名前を使ったcssがあるとすると
$checkExists = file_exists($pageTypeCss);//そもそもそのcssファイルが存在するか
if(!$checkExists):?>
<link rel="stylesheet" href="<?php echo $pageTypeCss;?>">
<?php endif; // あるならlinkタグで出力。ないならそのまま ?>
@kohki-shikata
Copy link
Author

This snippet must be written in header.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment