File "single-products.php"
Full path: /home/xs854402/smcse.co.jp/public_html/wp-content/themes/Sumitomo-Mitsui/single-products.php
File
size: 11.28 B (11.28 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php get_header(); ?>
<main class="corporate">
<?php include('template/bottom-corporate-products.php'); ?>
<div class="c-breadcrumb">
<div class="c-breadcrumb__inner l-inner">
<?php
echo '<span property="itemListElement" typeof="ListItem">';
echo '<a property="item" typeof="WebPage" title="三井住友建設鉄構エンジニアリング株式会社へ移動する" href="'.esc_url(home_url('/')).'" class="home">';
echo '<span property="name">ホーム</span>';
echo '</a>';
echo '<meta property="position" content="1">';
echo '</span>';
echo ' > ';
echo '<span property="itemListElement" typeof="ListItem">';
echo '<a property="item" typeof="WebPage" title="技術紹介へ移動する" href="'.esc_url(home_url('/products/')).'" class="archive">';
echo '<span property="name">技術紹介</span>';
echo '</a>';
echo '<meta property="position" content="2">';
echo '</span>';
echo ' > ';
echo '<span property="itemListElement" typeof="ListItem">';
echo '<span property="name" class="post post-post current-item">';
echo the_title();
echo '</span>';
echo '<meta property="url" content="';
the_permalink();
echo '">';
echo '<meta property="position" content="3">';
echo '</span>';
?>
</div>
</div>
<section class="p-post">
<div class="p-post__container">
<div class="p-post__inner l-inner l-inner--narrowest">
<div class="p-post__contents">
<div class="p-post__block">
<p class="p-post__theme"><?php the_title(); ?></p>
<?php if (have_rows('lead')) : ?>
<?php while (have_rows('lead')) : the_row(); ?>
<h2 class="p-post__title"><?php the_sub_field('lead-title'); ?></h2>
<?php
$acf_row_image = get_sub_field('lead-img');
$url = $acf_row_image['url'];
$alt = $acf_row_image['alt'];
if ($url) :
?>
<div class="p-post__img">
<img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>">
</div>
<?php if($acf_row_image['caption']) : ?>
<p class="p-post__caption"><?php echo $acf_row_image['caption']; ?></p>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
if(have_rows('theme-block')) :
while (have_rows('theme-block')) : the_row();
?>
<?php if (get_sub_field('theme-item')) : ?>
<?php
$group = get_sub_field('theme-item');
if($group) :
?>
<div class="p-post__block">
<p class="p-post__theme"><?php echo $group['theme-subject']; ?></p>
<h2 class="p-post__title"><?php echo $group['theme-title']; ?></h2>
<p class="p-post__text c-text"><?php echo $group['theme-text']; ?></p>
<?php if($group['theme-imgs']) : ?>
<div class="p-post__imgs">
<?php
$imgs = $group['theme-imgs'];
foreach($imgs as $img) :
?>
<?php
$acf_row_image = $img['theme-img'];
if (is_array($acf_row_image) && !empty($acf_row_image['url'])) :
$url = $acf_row_image['url'];
$alt = !empty($acf_row_image['alt']) ? $acf_row_image['alt'] : '';
?>
<div class="p-post__smallImg">
<img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>">
<?php if($acf_row_image['caption']) : ?>
<p class="p-post__caption"><?php echo $acf_row_image['caption']; ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php
endwhile;
endif;
?>
<?php if(have_rows('info-block')) : ?>
<div class="p-post__block">
<p class="p-post__theme">技術関連情報</p>
<div class="p-post__list">
<?php while (have_rows('info-block')) : the_row(); ?>
<div class="p-post__item">
<p class="p-post__itemTheme"><?php echo get_sub_field('info-theme'); ?></p>
<p class="p-post__itemText"><?php echo get_sub_field('info-text'); ?></p>
</div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<div class="p-post__link">
<a href="<?php echo esc_url(home_url('/products/')); ?>" class="c-link">技術紹介一覧に戻る</a>
</div>
</div>
</div>
</div>
<div class="p-post__other p-post__other--bg">
<div class="p-post__inner l-inner">
<?php $post_term = wp_get_object_terms($post->ID, 'products-cat'); ?>
<p class="p-post__entitle c-entitle c-entitle--capitalize">see other <?php echo $post_term[0]->slug; ?>-related<br class="u-desktop"> technologies</p>
<h2 class="p-post__title c-title">他の<?php echo $post_term[0]->name; ?>技術を見る</h2>
</div>
<div class="p-post__swiper swiper js-otherSwiper">
<?php
$the_query = new WP_Query();
$param = array(
'paged' => $paged,
'post_type' => 'products',
'posts_per_page' => '6',
'post_status' => 'publish',
"post__not_in" => array($post->ID),
'tax_query' => array( // タクソノミーパラメーターを使用
array(
'taxonomy' => 'products-cat', // タームを取得タクソノミーを指定
'field' => 'slug', // スラッグに一致するタームを返す
'terms' => $post_term[0] // タームの配列を指定
)
)
);
?>
<?php $the_query->query($param);
if ($the_query->have_posts()) : ?>
<div class="swiper-wrapper">
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="swiper-slide">
<a href="<?php the_permalink(); ?>" class="p-post__slide p-relatedItem">
<?php
if(have_rows('look')) :
while (have_rows('look')) : the_row(); ?>
<?php
$acf_row_image = get_sub_field('look-img');
$url = $acf_row_image['url'];
$alt = $acf_row_image['alt'];
if ($url) :
?>
<div class="p-relatedItem__img c-img">
<img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>">
</div>
<?php endif; ?>
<?php
endwhile;
endif;
?>
<p class="p-relatedItem__title"><?php the_title(); ?></p>
</a>
</div>
<?php endwhile; ?>
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="swiper-slide">
<a href="<?php the_permalink(); ?>" class="p-post__slide p-relatedItem">
<?php
if(have_rows('look')) :
while (have_rows('look')) : the_row(); ?>
<?php
$acf_row_image = get_sub_field('look-img');
$url = $acf_row_image['url'];
$alt = $acf_row_image['alt'];
if ($url) :
?>
<div class="p-relatedItem__img c-img">
<img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>">
</div>
<?php endif; ?>
<?php
endwhile;
endif;
?>
<p class="p-relatedItem__title"><?php the_title(); ?></p>
</a>
</div>
<?php endwhile; ?>
</div>
<?php endif;
wp_reset_postdata(); ?>
<div class="swiper-pagination other-swiper-pagination"></div>
</div>
</div>
</section>
</main>
<?php get_footer();