※社内専用

カテゴリ一覧ページ h1背景画像

現在のEPRESSの仕様だと
カテゴリ一覧ページの場合、記事数が0だとスラッグ名が取得できず
h1背景画像が表示されない。
ダミー記事をいれとけば対応可能だが
中で解決できないか調べてみた。

master.php

  <main>
    <?php
      $slugs = $settings['slugs'];
      $flag_prallax = $settings['flag_prallax'];
      $flag_column_under = $settings['flag_column_under'];
      $bg_style = '';
      if( is_archive() ){
        $cat_info = get_category($cat);
        $slug = $cat_info->slug;

以下の部分を変更した

$cat_info = get_category($cat);
$slug = $cat_info->slug;

http://www.kerenor.jp/get-category-and-get-the-category/
によると


カテゴリーアーカイブページ(category.php)では、変数$catには現在表示されているカテゴリーのIDが自動的に入ります。

とのこと