回答編集履歴
1
コメントへの回答を追記。
test
CHANGED
@@ -87,3 +87,83 @@
|
|
87
87
|
【Wordpressの現在の記事につけているタグの情報を取得するget_the_tags】
|
88
88
|
|
89
89
|
[http://mizyupon-rpg.com/posts/703.html](http://mizyupon-rpg.com/posts/703.html)
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
---
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
**追記:**
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
> ②組んだhtmlをどのように$htmlに入れるのでしょうか?通常、組むhtmlは情報量が多くて、1行で終わらないのですが。。。
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```PHP
|
106
|
+
|
107
|
+
// ヒアドキュメント + sprintf
|
108
|
+
|
109
|
+
$html = <<< EOF
|
110
|
+
|
111
|
+
<div>
|
112
|
+
|
113
|
+
ID:%1$s<br>
|
114
|
+
|
115
|
+
Date:%2$s<br>
|
116
|
+
|
117
|
+
Title:%3$s<br>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
EOF;
|
122
|
+
|
123
|
+
$html = sprintf( $html, $post->ID, $post->post_date, esc_html( $post->post_title ) );
|
124
|
+
|
125
|
+
```とか
|
126
|
+
|
127
|
+
```PHP
|
128
|
+
|
129
|
+
// 代入演算子「.=」
|
130
|
+
|
131
|
+
$html .= '<div>';
|
132
|
+
|
133
|
+
$html .= 'ID:'.$post->ID.'<br>';
|
134
|
+
|
135
|
+
$html .= 'Date:'.$post->post_date.'<br>';
|
136
|
+
|
137
|
+
$html .= 'Title:'.esc_html( $post->post_title ).'<br>';
|
138
|
+
|
139
|
+
$html .= '</div>';
|
140
|
+
|
141
|
+
```
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
【PHP ヒアドキュメントの使い方:2通り - すたら日記】
|
146
|
+
|
147
|
+
[http://d.hatena.ne.jp/sutara_lumpur/20080803/1217724875](http://d.hatena.ne.jp/sutara_lumpur/20080803/1217724875)
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
【ヒアドキュメント | PHP プログラミング解説】
|
154
|
+
|
155
|
+
[http://so-zou.jp/web-app/tech/programming/php/grammar/data-type/string/here-document.htm](http://so-zou.jp/web-app/tech/programming/php/grammar/data-type/string/here-document.htm)
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
【PHP: sprintf - Manual】
|
160
|
+
|
161
|
+
[http://php.net/manual/ja/function.sprintf.php](http://php.net/manual/ja/function.sprintf.php)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
【PHP: 代入演算子 - Manual】
|
166
|
+
|
167
|
+
[http://php.net/manual/ja/language.operators.assignment.php](http://php.net/manual/ja/language.operators.assignment.php)
|
168
|
+
|
169
|
+
|