よろしくお願いします。
1週間ほど前から同じSyntaxエラーで悩んでいます。
php
1<?php 2// 格納変数 3$functions_php = null; 4 5$functions_php = " 6<?php 7/********** ウィジェットエリア ***************/ 8// サイドバーのウィジェット 9register_sidebar( array( 10 'name' => __( 'Side Widget' ), 11 'id' => 'side-widget', 12 'before_widget' => '<li class="; $functions_php .= '"widget-container"'; $functions_php .= ">', 13 'after_widget' => '</li>', 14 'before_title' => '<h3>', 15 'after_title' => '</h3>', 16) ); 17 18// フッターエリアのウィジェット 19register_sidebar( array( 20 'name' => __( 'Footer Widget' ), 21 'id' => 'footer-widget', 22 'before_widget' => '<div class="; $functions_php .= '"widget-area"'; $functions_php .= "><ul><li class="; $functions_php .= '"widget-container"'; $functions_php .= ">', 23 'after_widget' => '</li></ul></div>', 24 'before_title' => '<h3>', 25 'after_title' => '</h3>', 26) ); 27 28/**************************************/ 29 30// アイキャッチ画像 31add_theme_support( 'post-thumbnails' ); 32set_post_thumbnail_size(220, 165, true ); // 幅 220px、高さ 165px、切り抜きモード 33 34// カスタムナビゲーションメニュー 35add_theme_support('menus'); 36 37"; 38 39if(isset($layout['main_visual'])){ 40 41 $functions_php .= " 42 // ヘッダー画像 43 $args = array( 44 'width' => 1100, 45 'height' => auto, 46 'header-text' => true, 47 'default-image' => get_template_directory_uri() . '/images/"; $functions_php .= $layout["main_visual"]; $functions_php .= "', 48 'uploads' => true, 49 ); 50 add_theme_support( 'custoom-header',$args ); 51 "; 52 53} // 39行目のifの閉じ 54 55$functions_php .= " ?>"; 56?>
このコードで、
Parse error: syntax error, unexpected '$functions_php' (T_VARIABLE) in C:\phpdocs\nonprothemes\functions_temp.php on line 55
といったエラーが出ます。
画面は背景真っ白にエラー文のみです。
55行目を消してみると、本来の背景に、
Notice: Use of undefined constant - assumed ' ' in C:\phpdocs\nonprothemes\functions_temp.php on line 56
というエラー文が出ます。
いろいろ試した結果、if(isset($layout['main_visual'])){と}を消した場合、
Notice: Undefined variable: args in C:\phpdocs\nonprothemes\functions_temp.php on line 47
というエラー文が出ます。
$layout['main_visual']の中身は存在していても空でも結果は上記の通りのエラーが出力されます。
どこに間違いがあるのでしょうか?
ご指摘のほどよろしくお願いします。
追記:編集後のコードを記載
php
1<?php 2// 格納変数 3$functions_php = null; 4 5$functions_php = " 6 7/********** ウィジェットエリア ***************/ 8// サイドバーのウィジェット 9register_sidebar( array( 10 'name' => __( 'Side Widget' ), 11 'id' => 'side-widget', 12 'before_widget' => '<li class="; $functions_php .= 'widget-container"'; $functions_php .= ">', 13 'after_widget' => '</li>', 14 'before_title' => '<h3>', 15 'after_title' => '</h3>', 16) ); 17 18// フッターエリアのウィジェット 19register_sidebar( array( 20 'name' => __( 'Footer Widget' ), 21 'id' => 'footer-widget', 22 'before_widget' => '<div class="; $functions_php .= 'widget-area"'; $functions_php .= "><ul><li class="; $functions_php .= 'widget-container"'; $functions_php .= ">', 23 'after_widget' => '</li></ul></div>', 24 'before_title' => '<h3>', 25 'after_title' => '</h3>', 26) ); 27 28/**************************************/ 29 30// アイキャッチ画像 31add_theme_support( 'post-thumbnails' ); 32set_post_thumbnail_size(220, 165, true ); // 幅 220px、高さ 165px、切り抜きモード 33 34// カスタムナビゲーションメニュー 35add_theme_support('menus'); 36 37"; 38 39if(isset($layout['main_visual'])){ 40 41 $functions_php .= " 42 // ヘッダー画像 43 $"; $functions_php .= "args = array( 44 'width' => 1100, 45 'height' => auto, 46 'header-text' => true, 47 'default-image' => get_template_directory_uri() . '/images/"; 48 $functions_php .= $layout["main_visual"]; $functions_php .= "', 49 'uploads' => true, 50 ); 51 add_theme_support( 'custoom-header',$"; $functions_php .= "args ); 52 "; 53 54} // 39行目のifの閉じ 55 56?>
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/01/14 02:36