File: /var/www/html/wp-content/themes/ganryujima_new_1602/single/event_results.php
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php
$date = get_field('event_date',$post->ID);
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$days = substr($date, 6, 2);
$day = substr($date, 8);
?>
<?php
$img = get_field('cover');
$imgurl = wp_get_attachment_image_src($img, '16-9');
?>
<div class="event_title_bg" style="background-image:url(<?php if($imgurl){ echo $imgurl[0]; } ?>);">
<div class="event_title table">
<div class="date">
<span>
<span class="year"><?php echo $year ; ?></span>
<span class="days"><?php echo $month.'.'.$days ; ?></span>
<span class="day">(<?php echo $day ; ?>)</span>
</span>
</div>
<div class="cell">
<h1>
<?php the_title(); ?>
<aside class="pc">
<span>
<i class="fa fa-map-marker"></i>開催場所:
<?php the_field('place',$post->ID); ?>
</span>
<span>
<i class="fa fa-users"></i>観衆:
<?php the_field('audience',$post->ID); ?>
</span>
<span>
<i class="fa fa-television"></i>視聴率:
<?php the_field('rating',$post->ID); ?>
</span>
</aside>
</h1>
<?php if(!wp_is_mobile() || is_Kindle() || is_ipad()){ ?>
<?php include(TEMPLATEPATH.'/_page_sns.php'); ?>
<?php } ?>
</div>
</div>
</div>
<?php if(wp_is_mobile() && !is_Kindle() && !is_ipad()){ ?>
<table class="event_info">
<?php if(get_field('place',$post->ID)) : ?>
<tr>
<th>開催場所</th>
<td>
<?php the_field('place',$post->ID); ?>
</td>
</tr>
<?php endif; ?>
<?php if(get_field('audience',$post->ID)) : ?>
<tr>
<th>観衆</th>
<td>
<?php the_field('audience',$post->ID); ?>
</td>
</tr>
<?php endif; ?>
<?php if(get_field('rating',$post->ID)) : ?>
<tr>
<th>視聴率</th>
<td>
<?php the_field('rating',$post->ID); ?>
</td>
</tr>
<?php endif; ?>
</table>
<?php include(TEMPLATEPATH.'/_page_sns.php'); ?>
<?php } ?>
<?php if(get_the_content()) : ?>
<div class="event_content l-paper">
<?php the_content(); ?>
</div>
<?php endif; ?>
<?php if( have_rows('results') ): $count = 1;?>
<ul class="event_results">
<?php while( have_rows('results') ): the_row(); ?>
<li>
<div class="event-result-outer">
<p class="result-title"><?php the_sub_field('title',$post->ID); ?></p>
<div class="overlay pc"></div>
<div class="table event-result">
<div class="cell">
<div class="table <?php if(get_sub_field('winner') == 'fighter1'){echo 'winner';} ?>">
<?php
$post_object = get_sub_field('fighter1');
if( $post_object ):
$post = $post_object;
setup_postdata( $post );
?>
<div class="fighter-cell">
<div class="fighter-icon">
<?php
$img = get_field('fighter_list_thumbnail');
?>
<?php if($img){ ?>
<img class="image icon" src="<?php echo $img['sizes']['icon']; ?>" alt="">
<?php } else { ?>
<img src="<?= home_url() ?>/assets/images/dummyicon.jpg" alt="SAMURAI WARRIOR">
<?php } ?>
<div class="m-frame">
<?php include(TEMPLATEPATH.'/images/frame.php'); ?>
</div>
</div>
</div>
<div class="fighter-cnt">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="base">
<?php $bases = get_the_terms($post->ID, 'fighter-base');
if ($bases) {
foreach( $bases as $base ){
echo $base->name;
}
}
?>
/<?php the_field('fighter_from',$post->ID); ?>
</p>
<span class="win-badge">WINNER</span>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
<div class="vs">
<img src="<?= home_url() ?>/assets/images/vs.svg" alt="vs">
</div>
<div class="cell">
<div class="table <?php if(get_sub_field('winner') == 'fighter2'){echo 'winner';} ?>">
<?php
$post_object = get_sub_field('fighter2');
if( $post_object ):
$post = $post_object;
setup_postdata( $post );
?>
<?php if(!wp_is_mobile() || is_Kindle() || is_ipad()){ ?>
<div class="fighter-cnt">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="base">
<?php $bases = get_the_terms($post->ID, 'fighter-base');
if ($bases) {
foreach( $bases as $base ){
echo $base->name;
}
}
?>
/<?php the_field('fighter_from',$post->ID); ?>
</div>
<span class="win-badge">WINNER</span>
</div>
<?php } ?>
<div class="fighter-cell">
<div class="fighter-icon">
<?php
$img = get_field('fighter_list_thumbnail');
?>
<?php if($img){ ?>
<img class="image icon" src="<?php echo $img['sizes']['icon']; ?>" alt="">
<?php } else { ?>
<img src="<?= home_url() ?>/assets/images/dummyicon.jpg" alt="SAMURAI WARRIOR">
<?php } ?>
<div class="m-frame">
<?php include(TEMPLATEPATH.'/images/frame.php'); ?>
</div>
</div>
</div>
<?php if(wp_is_mobile() && !is_Kindle() && !is_ipad()){ ?>
<div class="fighter-cnt">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="base">
<?php $bases = get_the_terms($post->ID, 'fighter-base');
if ($bases) {
foreach( $bases as $base ){
echo $base->name;
}
}
?>
/<?php the_field('fighter_from',$post->ID); ?>
</div>
<span class="win-badge">WINNER</span>
</div>
<?php } ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
</div>
<?php $description = get_sub_field('description',$post->ID); ?>
<div class="how-win">
<p>
<?php the_sub_field('how_win',$post->ID); ?>
<?php if($description) { ?>
<a ng-click="open<?php echo $count; ?> = true" ng-show="!open<?php echo $count; ?>">詳しく</a>
<a ng-click="open<?php echo $count; ?> = false" ng-show="open<?php echo $count; ?>">閉じる</a>
<?php } ?>
</p>
</div>
</div>
<?php if($description) { ?>
<div class="result-description" ng-class="{'show': open<?php echo $count; ?>}"><?php echo $description; ?></div>
<?php } ?>
</li>
<?php $count ++; endwhile; ?>
</ul>
<?php endif; ?>
<?php include('_links.php'); ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>