Skip to content

Instantly share code, notes, and snippets.

@mypacecreator
Created July 2, 2014 17:47
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 mypacecreator/7704f10fb02fec918e05 to your computer and use it in GitHub Desktop.
Save mypacecreator/7704f10fb02fec918e05 to your computer and use it in GitHub Desktop.
アーカイプページで、カテゴリースラッグを元にタイトル画像を表示する(子カテゴリーの場合、自カテゴリーの画像を使う)
<?php if(is_category()): ?>
<h1><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php
$cat_id = get_query_var('cat');
$cat = get_category($cat_id);
echo $cat->category_nicename;
?>.jpg" alt="<?php single_cat_title(); ?>" /></h1>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment