teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

文字列内の\$argsが変数として認識される問題を\(たぶん\)解決したコード

2016/01/14 02:29

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -80,4 +80,65 @@
80
80
  $layout['main_visual']の中身は存在していても空でも結果は上記の通りのエラーが出力されます。
81
81
 
82
82
  どこに間違いがあるのでしょうか?
83
- ご指摘のほどよろしくお願いします。
83
+ ご指摘のほどよろしくお願いします。
84
+
85
+ 追記:編集後のコードを記載
86
+
87
+ ```php
88
+ <?php
89
+ // 格納変数
90
+ $functions_php = null;
91
+
92
+ $functions_php = "
93
+
94
+ /********** ウィジェットエリア ***************/
95
+ // サイドバーのウィジェット
96
+ register_sidebar( array(
97
+ 'name' => __( 'Side Widget' ),
98
+ 'id' => 'side-widget',
99
+ 'before_widget' => '<li class="; $functions_php .= 'widget-container"'; $functions_php .= ">',
100
+ 'after_widget' => '</li>',
101
+ 'before_title' => '<h3>',
102
+ 'after_title' => '</h3>',
103
+ ) );
104
+
105
+ // フッターエリアのウィジェット
106
+ register_sidebar( array(
107
+ 'name' => __( 'Footer Widget' ),
108
+ 'id' => 'footer-widget',
109
+ 'before_widget' => '<div class="; $functions_php .= 'widget-area"'; $functions_php .= "><ul><li class="; $functions_php .= 'widget-container"'; $functions_php .= ">',
110
+ 'after_widget' => '</li></ul></div>',
111
+ 'before_title' => '<h3>',
112
+ 'after_title' => '</h3>',
113
+ ) );
114
+
115
+ /**************************************/
116
+
117
+ // アイキャッチ画像
118
+ add_theme_support( 'post-thumbnails' );
119
+ set_post_thumbnail_size(220, 165, true ); // 幅 220px、高さ 165px、切り抜きモード
120
+
121
+ // カスタムナビゲーションメニュー
122
+ add_theme_support('menus');
123
+
124
+ ";
125
+
126
+ if(isset($layout['main_visual'])){
127
+
128
+ $functions_php .= "
129
+ // ヘッダー画像
130
+ $"; $functions_php .= "args = array(
131
+ 'width' => 1100,
132
+ 'height' => auto,
133
+ 'header-text' => true,
134
+ 'default-image' => get_template_directory_uri() . '/images/";
135
+ $functions_php .= $layout["main_visual"]; $functions_php .= "',
136
+ 'uploads' => true,
137
+ );
138
+ add_theme_support( 'custoom-header',$"; $functions_php .= "args );
139
+ ";
140
+
141
+ } // 39行目のifの閉じ
142
+
143
+ ?>
144
+ ```