File: /var/www/html/wp-content/themes/ganryujima_new_1602/_side_column.php
<div class="l-lists">
<?php
echo '<h2>人気記事<span class="en">/POPULAR</span></h2>';
get_my_popular_posts();
//if (is_page('budo') || is_singular('grjm_budo')) {
// echo '<h2>人気記事<span class="en">/POPULAR</span></h2>';
// get_my_popular_posts('grjm_budo');
//} else if (is_page('event') || is_singular('grjm_events')) {
// echo '<h2>人気イベント<span class="en">/POPULAR</span></h2>';
// get_my_popular_posts('grjm_events');
//} else if (is_page('discussion') || is_singular('grjm_discussion')) {
// echo '<h2>人気議論<span class="en">/POPULAR</span></h2>';
// get_my_popular_posts('grjm_discussion');
//} else {
// echo '<h2>人気記事<span class="en">/POPULAR</span></h2>';
// get_my_popular_posts();
//}
?>
</div>
<?php $args = array(
'post_type' => 'grjm_events',
'posts_per_page' => '2',
'meta_key' => 'event_date',
'meta_query' => array(array(
'key' => 'banner',
'value' => true
)),
'order' => 'DESC',
'orderby' => 'meta_value_num'
); ?>
<?php $loop = new WP_Query( $args ); ?>
<?php if($loop -> have_posts()): ?>
<div class="l-lists">
<h2>試合情報<span class="en">/EVENTS</span></h2>
<?php while($loop -> have_posts()): $loop->the_post();?>
<?php
$date = get_field('event_date',$post->ID);
$month = substr($date, 4, 2);
$days = substr($date, 6, 2);
$day = substr($date, 8);
$day = str_replace('曜日', '', $day);
?>
<article class="block_article m_side_event" alt="<?php the_permalink(); ?>">
<a href="<?php the_permalink() ?>">
<div class="cover">
<?php
$img = get_field('cover');
$imgurl = wp_get_attachment_image_src($img, '16-9');
?>
<?php if($imgurl){ ?>
<img src="<?php echo $imgurl[0]; ?>" alt="">
<?php } else { ?>
<img src="<?= home_url() ?>/assets/images/dummy16-9.jpg" alt="SAMURAI WARRIOR">
<?php } ?>
<div class="cnt">
<h2>
<span><span class="num"><?php echo $month.'.'.$days ; ?></span><?php echo '('.$day.')'; ?></span>
<?php the_field('place',$post->ID); ?>
</h2>
<h1><?php the_title(); ?></h1>
<aside><?php the_field('time',$post->ID); ?></aside>
</div>
</div>
<p class="more">詳しく見る</p>
</a>
</article>
<?php endwhile;?>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>