Skip to content

Instantly share code, notes, and snippets.

@yhira
Created July 9, 2018 13:12
Show Gist options
  • Save yhira/559bd516406377cdd105d0d93ea86deb to your computer and use it in GitHub Desktop.
Save yhira/559bd516406377cdd105d0d93ea86deb to your computer and use it in GitHub Desktop.
Cocoonでget_skin_url関数をオーバーライドしてページ毎にスキンを切り替えるコード例
function get_skin_url(){
$skin_file = get_theme_option(OP_SKIN_URL, '');
if (is_single('m-sora')) {
$skin_file = get_template_directory_uri().'/skins/m-sora/style.css';
} elseif (is_single('itsumono-skin')) {
$skin_file = get_template_directory_uri().'/skins/skin-ganchan02/style.css';
} elseif (is_single('odekake')) {
$skin_file = get_template_directory_uri().'/skins/skin-ganchan11/style.css';
} elseif (is_single(array('modernblack', '0-6-2'))) {
$skin_file = get_template_directory_uri().'/skins/skin-modernblack/style.css';
} elseif (is_single(array('skin-dot'))) {
$skin_file = get_template_directory_uri().'/skins/skin-dot-winered/style.css';
} elseif (is_single(array('0-6-4'))) {
$skin_file = get_template_directory_uri().'/skins/skin-dot-rainyblue/style.css';
} elseif (is_single(array('skin-mix'))) {
$skin_file = get_template_directory_uri().'/skins/skin-mixred/style.css';
} elseif (is_single(array('lightning-skin'))) {
$skin_file = get_template_directory_uri().'/skins/lightning-skin/style.css';
} elseif (is_single(array('skin-samuraiblue', '0-7-6'))) {
$skin_file = get_template_directory_uri().'/skins/skin-samuraiblue/style.css';
} elseif (is_single(array('skin-ganchan21', '1-0-1'))) {
$skin_file = get_template_directory_uri().'/skins/skin-ganchan21/style.css';
} elseif (is_single(array('skin-samuraiblue-muji', '1-0-2'))) {
$skin_file = get_template_directory_uri().'/skins/skin-samuraiblue-muji/style.css';
}
return $skin_file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment