File "date.php"

Full path: /home/xs854402/smcse.co.jp/public_html/test.smcse.co.jp/wp-content/themes/Sumitomo-Mitsui/date.php
File size: 4.78 B (4.78 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-news.php'); ?>
    <?php include('template/breadcrumb.php'); ?>
    <section class="p-archive">
        <div class="p-archive__heading">
            <div class="p-archive__inner l-inner">
                <div class="p-archive__search">
                <?php if (have_posts()):
while (have_posts()): the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
                    <h2 class="p-post__theme">お知らせ検索</h2>
                    <div class="p-archive__categories">
                        <?php
                        $terms = get_terms( 'news-cat');
                        echo '<p class="p-archive__category current">全体表示</p>';
                        foreach ( $terms as $term ){
                            echo '<a href="'.get_term_link($term->slug, 'news-cat').'" class="p-archive__category">'.$term->name.'</a>';
                        }
                        ?>
                    </div>
                    <ul class="p-archive__byYear">
                        <?php
                        $args = array (
                            'type' => 'daily', // yearly
                            'post_type' => 'news',
                            'order' => 'ASC'
                        );
                        $yearly_list = wp_get_archives($args, '年');
                        ?>
                    </ul>
                </div>
                <div class="p-archive__contents">
                    <div class="p-archive__contentsBlock">

                        <?php if ( have_posts() ) :
                        while ( have_posts() ) : the_post(); ?>
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        <?php endwhile; endif; ?>
                    </div>
                    <?php
                    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
                    $the_query = new WP_Query();
                    $param = array(
                        'paged'          => $paged,
                        'post_type'      => 'news',
                        'posts_per_page' => '10',
                        'post_status'    => 'publish',
                    );
                    $the_query->query($param);
                    if ($the_query->have_posts()) :
                    ?>
                        <div class="p-archive__items">
                            <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
                                <div class="p-archive__item p-newsItem">
                                    <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">
                                            <p class="p-newsItem__time">
                                                <time datetime="<?php the_time( 'c' ); ?>"><?php the_time( 'Y.m.d' ); ?></time>
                                            </p>
                                            <?php
                                            $terms = get_the_terms($post->ID, 'news-cat');
                                            if ( $terms ) {
                                                echo '<a href="'.esc_url(get_term_link($terms[0])).'" class="p-newsItem__category">'.$terms[0]->name.'</a>';
                                            }
                                            ?>
                                        </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>
            </div>
        </div>
    </section>
</main>
<?php get_footer();