質問編集履歴

1

追記

2018/11/01 08:50

投稿

murama2
murama2

スコア113

test CHANGED
File without changes
test CHANGED
@@ -25,3 +25,369 @@
25
25
 
26
26
 
27
27
  よろしくお願いいたします。
28
+
29
+
30
+
31
+ 追記
32
+
33
+ ==
34
+
35
+ 変わりの「the author meta」を使用しましたが、やはり1つ目は表示されず、2つ目は表示される状態です。
36
+
37
+ 下記が対象ファイルのコードになります。
38
+
39
+
40
+
41
+ ```ここに言語を入力
42
+
43
+ <?php get_header(); ?>
44
+
45
+ <div class="mainImg">
46
+
47
+ <h1 class="pageTitle">
48
+
49
+ <?php the_author_meta( nickname, $author ); ?>
50
+
51
+ </h1>
52
+
53
+ </div>
54
+
55
+ <div id="container">
56
+
57
+ <section id="section1" class="singleContentInner">
58
+
59
+ <?php
60
+
61
+ // カスタムフィールド値取得
62
+
63
+ $aID = get_the_author_meta(ID, $author);
64
+
65
+ $a_img = get_field('cp_img', 'user_' . $aID);
66
+
67
+ $a_title = get_field('cp_title', 'user_' . $aID);
68
+
69
+ $a_text = get_field('cp_text', 'user_' . $aID);
70
+
71
+ ?>
72
+
73
+ <?php
74
+
75
+ $args = array(
76
+
77
+ 'posts_per_page' => 3,
78
+
79
+ 'order' => 'DESC',
80
+
81
+ 'post_type' => 'member',
82
+
83
+ 'author_name' => $get_author,
84
+
85
+ );
86
+
87
+ $posts = new WP_Query($args);
88
+
89
+ ?>
90
+
91
+ <?php if($posts->have_posts()): ?>
92
+
93
+ <section id="section3">
94
+
95
+ <div class="title_h2">
96
+
97
+ <div class="title_h2_inner">
98
+
99
+ <h2><?php the_author_meta('display_name'); ?>の他のサービスを見る</h2>
100
+
101
+ </div>
102
+
103
+ </div>
104
+
105
+ <div class="contentArea">
106
+
107
+ <div class="clear newMemberList">
108
+
109
+
110
+
111
+ <?php while( $posts->have_posts() ) : $posts->the_post(); ?>
112
+
113
+ <div class="newMemberBox linkBox match_hg">
114
+
115
+ <a class="coverLink" href="<?php the_permalink() ?>"></a>
116
+
117
+ <div class="thumbnailBox">
118
+
119
+ <?php $member_terms = wp_get_object_terms($post->ID,'ctcategory'); $c_img1 = get_field("cf2_img"); ?>
120
+
121
+ <?php
122
+
123
+ if (!empty($member_terms) && !is_wp_error($member_terms)) {
124
+
125
+ usort($member_terms,"cmp_parent");
126
+
127
+ foreach ($member_terms as $member_term) {
128
+
129
+ if($member_term->parent == 0){
130
+
131
+ echo '<p class="cate">'.esc_html($member_term->name).'</p>';
132
+
133
+ }
134
+
135
+ }
136
+
137
+ }
138
+
139
+ ?>
140
+
141
+ <?php if ( $c_img1 ): ?>
142
+
143
+ <img src="<?php echo $c_img1 ?>" alt="<?php the_title() ?>">
144
+
145
+ <?php else: ?>
146
+
147
+ <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/common/no-image.png" alt="">
148
+
149
+ <?php endif; ?>
150
+
151
+ </div>
152
+
153
+ <h3>
154
+
155
+ <?php
156
+
157
+ if(mb_strlen($post->post_title, 'UTF-8')>20){
158
+
159
+ $title= mb_substr($post->post_title, 0, 20, 'UTF-8');
160
+
161
+ echo $title.'...';
162
+
163
+ }else{
164
+
165
+ echo $post->post_title;
166
+
167
+ }
168
+
169
+ ?>
170
+
171
+ </h3>
172
+
173
+ <div class="excerpt">
174
+
175
+ <?php
176
+
177
+ $c_txt = mb_substr(get_field("cf2_txt"),0,30,'utf-8');
178
+
179
+ $c_txt = strip_tags($c_txt);
180
+
181
+ if($c_txt){
182
+
183
+ echo $c_txt.'...';
184
+
185
+ }
186
+
187
+ ?>
188
+
189
+ </div>
190
+
191
+ <time class="time"><?php the_time('Y/n/j') ?></time>
192
+
193
+ </div>
194
+
195
+ <?php endwhile; wp_reset_postdata(); ?>
196
+
197
+ </div>
198
+
199
+ </div><!-- .contentArea -->
200
+
201
+ <p class="more">
202
+
203
+ <a href="<?php echo esc_url(home_url('/archives/member')); ?>?author=<?php echo $get_author ?>">サービス一覧を見る</a>
204
+
205
+ </p>
206
+
207
+ </section>
208
+
209
+ <?php endif; ?>
210
+
211
+
212
+
213
+ <?php if(get_the_author_meta('display_name')): ?>
214
+
215
+ <section id="section4">
216
+
217
+ <div class="title_h2">
218
+
219
+ <div class="title_h2_inner">
220
+
221
+ <h2><?php the_author_meta('display_name'); ?>について</h2>
222
+
223
+ </div>
224
+
225
+ </div>
226
+
227
+ <div class="contentArea">
228
+
229
+ <div class="clear">
230
+
231
+ <div class="leftImg">
232
+
233
+ <?php if($a_img): ?>
234
+
235
+ <img src="<?php echo $a_img ?>" alt="<?php the_title() ?>">
236
+
237
+ <?php else: ?>
238
+
239
+ <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/common/no-image.png" alt="">
240
+
241
+ <?php endif; ?>
242
+
243
+ </div>
244
+
245
+ <div class="rightContent authorBox">
246
+
247
+ <div class="author_data">
248
+
249
+ <?php
250
+
251
+ $a_establishment = get_field('establishment', 'user_' . $aID);
252
+
253
+ $a_representative = get_field('representative', 'user_' . $aID);
254
+
255
+ $a_zip = get_field('zip', 'user_' . $aID);
256
+
257
+ $a_address = get_field('address', 'user_' . $aID);
258
+
259
+ $a_business_contents = get_field('business_contents', 'user_' . $aID);
260
+
261
+ $a_mail = get_field('mail', 'user_' . $aID);
262
+
263
+ $a_tel = get_field('tel', 'user_' . $aID);
264
+
265
+ $a_fax = get_field('fax', 'user_' . $aID);
266
+
267
+ $a_siteurl = get_field('siteurl', 'user_' . $aID);
268
+
269
+ $a_contact = get_field('contact', 'user_' . $aID);
270
+
271
+ ?>
272
+
273
+ <?php if($a_establishment): ?>
274
+
275
+ <dl>
276
+
277
+ <dt>設立</dt>
278
+
279
+ <dd><?php echo $a_establishment ?></dd>
280
+
281
+ </dl>
282
+
283
+ <?php endif; ?>
284
+
285
+ <?php if($a_representative): ?>
286
+
287
+ <dl>
288
+
289
+ <dt>代表者</dt>
290
+
291
+ <dd><?php echo $a_representative ?></dd>
292
+
293
+ </dl>
294
+
295
+ <?php endif; ?>
296
+
297
+ <?php if($a_zip || $a_address): ?>
298
+
299
+ <dl>
300
+
301
+ <dt>所在地</dt>
302
+
303
+ <dd><?php echo $a_zip.'<br>' ?><?php echo $a_address ?></dd>
304
+
305
+ </dl>
306
+
307
+ <?php endif; ?>
308
+
309
+ <?php if($a_business_contents): ?>
310
+
311
+ <dl>
312
+
313
+ <dt>事業内容</dt>
314
+
315
+ <dd><?php echo $a_business_contents ?></dd>
316
+
317
+ </dl>
318
+
319
+ <?php endif; ?>
320
+
321
+ <?php if($a_tel): ?>
322
+
323
+ <dl>
324
+
325
+ <dt>電話番号</dt>
326
+
327
+ <dd><?php echo $a_tel ?></dd>
328
+
329
+ </dl>
330
+
331
+ <?php endif; ?>
332
+
333
+ <?php if($a_fax): ?>
334
+
335
+ <dl>
336
+
337
+ <dt>FAX番号</dt>
338
+
339
+ <dd><?php echo $a_fax ?></dd>
340
+
341
+ </dl>
342
+
343
+ <?php endif; ?>
344
+
345
+ <?php if($a_siteurl): ?>
346
+
347
+ <dl>
348
+
349
+ <dt>サイトURL</dt>
350
+
351
+ <dd><a href="<?php echo $a_siteurl ?>" target="_blank"><?php echo $a_siteurl ?></a></dd>
352
+
353
+ </dl>
354
+
355
+ <?php endif; ?>
356
+
357
+ </div>
358
+
359
+ <?php if($a_contact): ?>
360
+
361
+ <p class="more">
362
+
363
+ <a href="<?php echo $a_contact ?>" target="_blank">お問合せはこちら</a>
364
+
365
+ </p>
366
+
367
+ <?php elseif($a_mail): ?>
368
+
369
+ <p class="more">
370
+
371
+ <a href="mailto:<?php echo $a_mail ?>">お問合せはこちら</a>
372
+
373
+ </p>
374
+
375
+ <?php endif; ?>
376
+
377
+ </div>
378
+
379
+ </div>
380
+
381
+ </div><!-- .contentArea -->
382
+
383
+ </section>
384
+
385
+ <?php endif; ?>
386
+
387
+ </div><!-- #container -->
388
+
389
+ <?php get_footer(); ?>
390
+
391
+
392
+
393
+ ```