登録したユーザー情報ページ(auther.php)を作成し、ユーザー名など表示させているのですが、一部取得できない物があります。
ページ上部に記入した、「<?php the_author_nickname(); ?>」は取得&表示できなくて、
ページ下部に記入は「<?php the_author_nickname(); ?>」は取得&表示ができているという現象が起きており調べても解決策がでてこずこまっております。
また、複数ユーザーを登録したのですが、ユーザーAはユーザー情報を取得&表示できるのに、ユーザーBは全てのユーザー情報を取得できない状態にあります。
上記2点の問題について何か解決策などありますでしょうか。
・ページの2か所に入力した、「<?php the_author_nickname(); ?>」が一部ユーザーのみ1つ目は表示されず、2つ目の物だけ表示される。
・一部ユーザーのみユーザー情報(ユーザー名、メールアドレスなど)が取得できない状態
※どのユーザーも入力情報に違いなどありません。(空白が入っているなどもなし)
よろしくお願いいたします。
追記
変わりの「the author meta」を使用しましたが、やはり1つ目は表示されず、2つ目は表示される状態です。
下記が対象ファイルのコードになります。
<?php get_header(); ?> <div class="mainImg"> <h1 class="pageTitle"> <?php the_author_meta( nickname, $author ); ?> </h1> </div> <div id="container"> <section id="section1" class="singleContentInner"> <?php // カスタムフィールド値取得 $aID = get_the_author_meta(ID, $author); $a_img = get_field('cp_img', 'user_' . $aID); $a_title = get_field('cp_title', 'user_' . $aID); $a_text = get_field('cp_text', 'user_' . $aID); ?> <?php $args = array( 'posts_per_page' => 3, 'order' => 'DESC', 'post_type' => 'member', 'author_name' => $get_author, ); $posts = new WP_Query($args); ?> <?php if($posts->have_posts()): ?> <section id="section3"> <div class="title_h2"> <div class="title_h2_inner"> <h2><?php the_author_meta('display_name'); ?>の他のサービスを見る</h2> </div> </div> <div class="contentArea"> <div class="clear newMemberList"> <?php while( $posts->have_posts() ) : $posts->the_post(); ?> <div class="newMemberBox linkBox match_hg"> <a class="coverLink" href="<?php the_permalink() ?>"></a> <div class="thumbnailBox"> <?php $member_terms = wp_get_object_terms($post->ID,'ctcategory'); $c_img1 = get_field("cf2_img"); ?> <?php if (!empty($member_terms) && !is_wp_error($member_terms)) { usort($member_terms,"cmp_parent"); foreach ($member_terms as $member_term) { if($member_term->parent == 0){ echo '<p class="cate">'.esc_html($member_term->name).'</p>'; } } } ?> <?php if ( $c_img1 ): ?> <img src="<?php echo $c_img1 ?>" alt="<?php the_title() ?>"> <?php else: ?> <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/common/no-image.png" alt=""> <?php endif; ?> </div> <h3> <?php if(mb_strlen($post->post_title, 'UTF-8')>20){ $title= mb_substr($post->post_title, 0, 20, 'UTF-8'); echo $title.'...'; }else{ echo $post->post_title; } ?> </h3> <div class="excerpt"> <?php $c_txt = mb_substr(get_field("cf2_txt"),0,30,'utf-8'); $c_txt = strip_tags($c_txt); if($c_txt){ echo $c_txt.'...'; } ?> </div> <time class="time"><?php the_time('Y/n/j') ?></time> </div> <?php endwhile; wp_reset_postdata(); ?> </div> </div><!-- .contentArea --> <p class="more"> <a href="<?php echo esc_url(home_url('/archives/member')); ?>?author=<?php echo $get_author ?>">サービス一覧を見る</a> </p> </section> <?php endif; ?> <?php if(get_the_author_meta('display_name')): ?> <section id="section4"> <div class="title_h2"> <div class="title_h2_inner"> <h2><?php the_author_meta('display_name'); ?>について</h2> </div> </div> <div class="contentArea"> <div class="clear"> <div class="leftImg"> <?php if($a_img): ?> <img src="<?php echo $a_img ?>" alt="<?php the_title() ?>"> <?php else: ?> <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/common/no-image.png" alt=""> <?php endif; ?> </div> <div class="rightContent authorBox"> <div class="author_data"> <?php $a_establishment = get_field('establishment', 'user_' . $aID); $a_representative = get_field('representative', 'user_' . $aID); $a_zip = get_field('zip', 'user_' . $aID); $a_address = get_field('address', 'user_' . $aID); $a_business_contents = get_field('business_contents', 'user_' . $aID); $a_mail = get_field('mail', 'user_' . $aID); $a_tel = get_field('tel', 'user_' . $aID); $a_fax = get_field('fax', 'user_' . $aID); $a_siteurl = get_field('siteurl', 'user_' . $aID); $a_contact = get_field('contact', 'user_' . $aID); ?> <?php if($a_establishment): ?> <dl> <dt>設立</dt> <dd><?php echo $a_establishment ?></dd> </dl> <?php endif; ?> <?php if($a_representative): ?> <dl> <dt>代表者</dt> <dd><?php echo $a_representative ?></dd> </dl> <?php endif; ?> <?php if($a_zip || $a_address): ?> <dl> <dt>所在地</dt> <dd><?php echo $a_zip.'<br>' ?><?php echo $a_address ?></dd> </dl> <?php endif; ?> <?php if($a_business_contents): ?> <dl> <dt>事業内容</dt> <dd><?php echo $a_business_contents ?></dd> </dl> <?php endif; ?> <?php if($a_tel): ?> <dl> <dt>電話番号</dt> <dd><?php echo $a_tel ?></dd> </dl> <?php endif; ?> <?php if($a_fax): ?> <dl> <dt>FAX番号</dt> <dd><?php echo $a_fax ?></dd> </dl> <?php endif; ?> <?php if($a_siteurl): ?> <dl> <dt>サイトURL</dt> <dd><a href="<?php echo $a_siteurl ?>" target="_blank"><?php echo $a_siteurl ?></a></dd> </dl> <?php endif; ?> </div> <?php if($a_contact): ?> <p class="more"> <a href="<?php echo $a_contact ?>" target="_blank">お問合せはこちら</a> </p> <?php elseif($a_mail): ?> <p class="more"> <a href="mailto:<?php echo $a_mail ?>">お問合せはこちら</a> </p> <?php endif; ?> </div> </div> </div><!-- .contentArea --> </section> <?php endif; ?> </div><!-- #container --> <?php get_footer(); ?>
回答2件
あなたの回答
tips
プレビュー