<?php get_header(); ?>

    <section id="section1" class="inner_page inner_page_inner4">
        <div class="container-fluid section1">
            <div class="inner_page_tools">
                <ul>


                    <li class="share">
                        <a href="javascript:void(0);"></a>
                        <div class="social_link">
                            <ul>
                                <li class="facebook">
                                    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"
                                       target="_blank"></a>
                                </li>
                                <li class="twitter">
                                    <a href="https://twitter.com/home?status=<?php the_permalink(); ?>"
                                       target="_blank"></a>
                                </li>
                                <li class="googleplus">
                                    <a href="https://plus.google.com/share?url=<?php the_permalink(); ?>"
                                       target="_blank"></a>
                                </li>
                                <li class="telegram">
                                    <a href="tg://msg?url=<?php the_permalink(); ?>"
                                       target="_blank"></a>
                                </li>
                            </ul>
                        </div>
                    </li>

                </ul>
            </div>
            <div class="container">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="content">
                            <header class="title">
                                <h1><?php
	                                foreach((get_the_category()) as $category) {
		                                echo $category->cat_name . ' ';
	                                }
	                                ?></h1>
                            </header>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="pt"></div>
    </section>
    <main id="main" role="main">
        <div class="news_page">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="news_page_list">
                        <?php if(have_posts()) {
                            ?>


                            <ul>
                                <?php while (have_posts()) {
                                    the_post();
                                    ?>
                                    <li>
        <figure class="picture">
            <figcaption><?php the_title() ?></figcaption>
            <a href="<?php the_permalink(); ?>">
                <img height="205" width="370" src="<?php the_post_thumbnail_url(); ?>"
                     alt="<?php $image_id = get_post_thumbnail_id();
				     get_post_meta( $image_id, '_wp_attachment_image_alt', true ); ?>"
                     title="<?php the_title() ?>">
            </a>
        </figure>
        <a href="<?php the_permalink(); ?>"
           class="title"><?php the_title(); ?></a>

		<?php the_excerpt(); ?>


        <span class="date"><?php the_date(); ?></span>
        <a href="<?php the_permalink(); ?>"
           class="read_more">مشاهده بیشتر</a>
    </li>
                            <?php
                                }
                                ?>
                                <?php
                                    }
                                    else{
                                        echo '<div style="text-align:center; padding: 20%; font-size: 18px;"> <h1> هیچ پستی وجود ندارد </h1> </div>';
                                    }
                                    ?>

                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
<?php get_footer(); ?>