Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
test.smcse.co.jp
/
wp-content
/
themes
/
Sumitomo-Mitsui
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php get_header(); ?> <main class="corporate"> <?php include('template/bottom-corporate-news.php'); ?> <?php include('template/breadcrumb.php'); ?> <section class="p-archive"> <div class="p-archive__heading"> <div class="p-archive__inner l-inner l-inner--narrowest"> <div class="p-archive__postContents"> <div class="p-archive__info"> <time class="p-archive__time" datetime="<?php the_time( 'c' ); ?>"><?php the_time( 'Y年m月d日' ); ?></time> <?php $terms = get_the_terms($post->ID, 'news-cat'); if ( $terms ) { echo '<div class="p-newsItem__categories">'; foreach($terms as $term) { echo '<a href="'.esc_url(get_term_link($term)).'" class="p-archive__category">'.$term->name.'</a>'; } echo '</div>'; } ?> </div> <h1 class="p-archive__title"><?php the_title(); ?></h1> <?php if (has_post_thumbnail()) : ?> <div class="p-archive__thumbnail"> <?php the_post_thumbnail('post-thumbnail', array('alt' => the_title_attribute('echo=0'))); ?> </div> <?php endif; ?> <div class="p-archive__post"> <?php the_content(); ?> </div> </div> </div> </div> <div class="p-business__related p-business__related--bg"> <div class="p-article__inner l-inner"> <p class="p-article__entitle c-entitle c-entitle--capitalize">related articles</p> <h2 class="p-article__title c-title">関連記事</h2> <?php $post_term = wp_get_object_terms($post->ID, 'news-cat'); $the_query = new WP_Query(); $param = array( 'paged' => $paged, 'post_type' => 'news', 'posts_per_page' => '4', 'post_status' => 'publish', "post__not_in" => array($post->ID), 'tax_query' => array( // タクソノミーパラメーターを使用 array( 'taxonomy' => 'news-cat', // タームを取得タクソノミーを指定 'field' => 'slug', // スラッグに一致するタームを返す 'terms' => $post_term[0] // タームの配列を指定 ) ) ); $the_query->query($param); if ($the_query->have_posts()) : ?> <div class="p-article__items"> <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class="p-archive__item p-newsItem p-newsItem--related"> <a href="<?php the_permalink(); ?>" class="p-newsItem__img c-img"> <?php if (has_post_thumbnail()) : the_post_thumbnail('post-thumbnail', array('alt' => the_title_attribute('echo=0'))); else : echo '<img src="'.get_template_directory_uri().'/images/common/noimage.jpg" alt="'.esc_html(get_the_title()).'">'; endif; ?> </a> <div class="p-newsItem__body"> <div class="p-newsItem__info"> <time class="p-newsItem__time" datetime="<?php the_time( 'c' ); ?>"><?php the_time( 'Y.m.d' ); ?></time> <?php $terms = get_the_terms($post->ID, 'news-cat'); if ( $terms ) { echo '<div class="p-newsItem__categories">'; $num = 0; foreach($terms as $term) { if($num <= 1) : echo '<a href="'.esc_url(get_term_link($term)).'" class="p-newsItem__category">'.$term->name.'</a>'; endif; $num++; } echo '</div>'; } ?> </div> <p class="p-newsItem__title"><?php the_title(); ?></p> <p class="p-newsItem__text"><?php remove_filter('the_excerpt', 'wpautop'); the_excerpt();?></p> <a href="<?php the_permalink(); ?>" class="p-newsItem__link">続きを読む</a> </div> </div> <?php endwhile; ?> </div> <?php endif; wp_reset_postdata(); ?> <div class="p-article__search"> <?php include('template/search.php'); ?> </div> </div> </div> </section> </main> <?php get_footer();