お知らせのPHP

                    <ul class="list">
                        <?php
                        $args=array("posts_per_page" => 10,"category_name" => 'news,media,case');
                        $posts=get_posts($args);
                        ?>
                        <?php
                        if($posts): foreach($posts as $post): setup_postdata($post);
                        $cat = get_the_category();
                        $cat = $cat[0];
                        ?>
                        <li>
                            <a href="<?php the_permalink(); ?>">
                                <div class="date">
                                    <time datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('Y.m.d'); ?></time>
                                </div>
                                <div class="label">
                                    <span class="label <?php echo $cat->slug; ?>"><?php echo $cat->name; ?></span>
                                </div>
                                <div class="title">
                                    <?php the_title();?>
                                </div>
                            </a>
                        </li>
                        <?php endforeach; endif; ?>
                    </ul>