ワードプレス初心者です。
タクソノミーの一覧ページを作るための固定ページを作成しました。
しかし、<?php the_title(); ?>が、固定ページ自体のタイトルを取得してしまい、困っています。
本来は、記事タイトルを取得させたいのですが、どのようなアプローチがあるでしょうか。
<?php $args = array( 'include_children' => true, 'post_type' => 'interview', 'taxonomy' => 'career_interview', 'term' => 'tech', 'posts_per_page' => 4 ); $customPosts = get_posts($args); if($customPosts) : foreach($customPosts as $post) : setup_postdata( $post ); ?> <div class="cont quadCont "> <section class="thumbnail"> <img src="<?php echo wp_get_attachment_image_src ( post_custom('一覧表示用画像'), 'full' )[0]; ?>" > </section> <p class="<?php if ($terms = get_the_terms($post->ID, 'career_interview')) { foreach ( $terms as $term ) { echo esc_html($term->slug) ; } } ?> occupation"> <?php echo get_post_meta($post->ID , '役職' , true); ?></p> <p class="title"><?php the_title(); ?></p> <p class="name"><?php echo get_post_meta($post->ID , '名前' , true); ?></p> </div> <?php endforeach; ?> <?php else : ?> <?php endif; wp_reset_postdata(); ?>
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー