PHPエラーの原因を知りたい
Warning: Cannot modify header information - headers already sent by (output started at /home/users/1/○/web/○/wp-content/themes/○/『functions.php:156』) in /home/users/1/○/web/○/wp-includes/『pluggable.php on line 1179』
上記のエラーメッセージがでます。『』はただの強調です。
attitudeと呼ばれる公式テンプレートのphpをいじりました。
functions.php:156行目に
<?php
register_sidebar(array(
'name' => 'Content2' ,
'id' => 'content2' ,
'before_widget' => '<div class="container">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>'
));
;?>
を追加したところ、上記のエラーが出るようになりました。
pluggable.php on line 1179は
header("Location: $location", true, $status);
になります。
function.phpとpluggable.phpとの繋がりがわかりません。pluggable.phpのデータはロリポップに標準搭載されたファイルになります。
header("Location: $location", true, $status);については日本語情報が乏しいです。
"function.phpソース"
<?php
/**
* Attitude defining constants, adding files and WordPress core functionality.
*
* Defining some constants, loading all the required files and Adding some core functionality.
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menu() To add support for navigation menu.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @package Theme Horse
* @subpackage Attitude
* @since Attitude 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 700;
add_action( 'attitude_init', 'attitude_constants', 10 );
/**
* This function defines the Attitude theme constants
*
* @since 1.0
*/
function attitude_constants() {
/** Define Directory Location Constants */
define( 'ATTITUDE_PARENT_DIR', get_template_directory() );
define( 'ATTITUDE_CHILD_DIR', get_stylesheet_directory() );
define( 'ATTITUDE_IMAGES_DIR', ATTITUDE_PARENT_DIR . '/images' );
define( 'ATTITUDE_LIBRARY_DIR', ATTITUDE_PARENT_DIR. '/library' );
define( 'ATTITUDE_ADMIN_DIR', ATTITUDE_LIBRARY_DIR . '/admin' );
define( 'ATTITUDE_ADMIN_IMAGES_DIR', ATTITUDE_ADMIN_DIR . '/images' );
define( 'ATTITUDE_ADMIN_JS_DIR', ATTITUDE_ADMIN_DIR . '/js' );
define( 'ATTITUDE_ADMIN_CSS_DIR', ATTITUDE_ADMIN_DIR . '/css' );
define( 'ATTITUDE_JS_DIR', ATTITUDE_LIBRARY_DIR . '/js' );
define( 'ATTITUDE_CSS_DIR', ATTITUDE_LIBRARY_DIR . '/css' );
define( 'ATTITUDE_FUNCTIONS_DIR', ATTITUDE_LIBRARY_DIR . '/functions' );
define( 'ATTITUDE_SHORTCODES_DIR', ATTITUDE_LIBRARY_DIR . '/shortcodes' );
define( 'ATTITUDE_STRUCTURE_DIR', ATTITUDE_LIBRARY_DIR . '/structure' );
if ( ! defined( 'ATTITUDE_LANGUAGES_DIR' ) ) /** So we can define with a child theme */
define( 'ATTITUDE_LANGUAGES_DIR', ATTITUDE_LIBRARY_DIR . '/languages' );
define( 'ATTITUDE_WIDGETS_DIR', ATTITUDE_LIBRARY_DIR . '/widgets' );
/** Define URL Location Constants */
define( 'ATTITUDE_PARENT_URL', get_template_directory_uri() );
define( 'ATTITUDE_CHILD_URL', get_stylesheet_directory_uri() );
define( 'ATTITUDE_IMAGES_URL', ATTITUDE_PARENT_URL . '/images' );
define( 'ATTITUDE_LIBRARY_URL', ATTITUDE_PARENT_URL . '/library' );
define( 'ATTITUDE_ADMIN_URL', ATTITUDE_LIBRARY_URL . '/admin' );
define( 'ATTITUDE_ADMIN_IMAGES_URL', ATTITUDE_ADMIN_URL . '/images' );
define( 'ATTITUDE_ADMIN_JS_URL', ATTITUDE_ADMIN_URL . '/js' );
define( 'ATTITUDE_ADMIN_CSS_URL', ATTITUDE_ADMIN_URL . '/css' );
define( 'ATTITUDE_JS_URL', ATTITUDE_LIBRARY_URL . '/js' );
define( 'ATTITUDE_CSS_URL', ATTITUDE_LIBRARY_URL . '/css' );
define( 'ATTITUDE_FUNCTIONS_URL', ATTITUDE_LIBRARY_URL . '/functions' );
define( 'ATTITUDE_SHORTCODES_URL', ATTITUDE_LIBRARY_URL . '/shortcodes' );
define( 'ATTITUDE_STRUCTURE_URL', ATTITUDE_LIBRARY_URL . '/structure' );
if ( ! defined( 'ATTITUDE_LANGUAGES_URL' ) ) /** So we can predefine to child theme */
define( 'ATTITUDE_LANGUAGES_URL', ATTITUDE_LIBRARY_URL . '/languages' );
define( 'ATTITUDE_WIDGETS_URL', ATTITUDE_LIBRARY_URL . '/widgets' );
}
文字数の関係でここまでです。末尾に"<?php register以下略ー"を追加しました
お礼
ご回答まことにありがとうございます。 ひじょうにご丁寧にご教授いただき たいへん感謝しております。 ありがとうございました。