親カテゴリーのテンプレートを子カテゴリーにも自動で適用するように、下記のトピックを拝見して記載の関数をfunctions.phpに記述したところ、エラーが出てログインできなくなってしまいました。
参考トピック
functions.phpの内容
<?php
if ( function_exists('register_sidebar') )
register_sidebars(3,array(
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="title03">',
'after_title' => '</h3>',
));
?>
<?php
//追記した関数はここから
function in_category_family( $parent ) {
if ( empty($parent) )
return false;
if ( in_category($parent) )
return true;
$parent = get_category($parent);
foreach ( (get_the_category()) as $child ) {
$child = get_category($child->cat_ID);
if ( cat_is_ancestor_of($parent, $child) )
return true;
}
return false;
}
?>
PHPエラー(ログイン画面に表示されています)
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/chicappa.jp/users/中略/wordpress/wp-content/themes/maroudo/functions.php:12) in /home/sites/chicappa.jp/users/中略/wordpress/wp-login.php on line 255
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/chicappa.jp/users/中略/wordpress/wp-content/themes/maroudo/functions.php:12) in /home/sites/chicappa.jp/users/中略/wordpress/wp-login.php on line 267
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/chicappa.jp/users/中略/wordpress/wp-content/themes/maroudo/functions.php:12) in /home/sites/chicappa.jp/users/中略/wordpress/wp-login.php on line 269
現在の症状
- ログインできません(関数の記述を削除するとログインできます)
- サイトは通常通り表示されています
- 追記した関数は動作しているようです
(各親カテゴリーのテンプレートがそれぞれの子カテゴリーに適用されている)
環境
・チカッパサーバ
・オペレーションシステム : Linux
・サーバー : Apache
・MYSQLバージョン : 4.0.26-standard-log
・PHPバージョン : 5.2.6
・WordPress2.7.1
各親カテゴリーのテンプレートをそれぞれの子カテゴリーに自動的に適用できるこの関数はとても便利なのでこれからも使用したいのですが、どのように修正したら良いのでしょうか?
何卒、ご教授よろしくお願いいたします。