<?php
/*
* Template Name: News Page
*
* */
get_header(); ?>
    <section class="container-fluid">
        <div class="row">
            <div class="container p_b_80 p_t_80">
                <div class="row m_t_80 m_b_80   about_text">
                    <div class="title_text col-md-12  ">
                        <h3>Publications</h3>
                    </div>
                    <?php
                    $query_args = array(
                        'post_type'      => 'publications',
                        'posts_per_page'  => '-1',
                        'orderby' => 'date',
                        'order' => 'ASC',
                    );
                    $publications = new WP_Query( $query_args );
                    $publications_count = 0;
                    if($publications->have_posts()): ?>
                        <div class="col-md-12 publications">
                            <div class="row m_t_30">
                                <?php while($publications->have_posts()): $publications->the_post(); $publications_count++; ?>
                                <?php if ($publications_count == 1): ?>
                                    <div class="col-md-12">
                                        <div class="blog_title_box">
											<div class="row">
												<div class="col-md-6">
													<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
													<p><?php $user_info = get_userdata(1);
														echo $user_info->first_name." ".$user_info->last_name;
														?><span class="dash">&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo custom_taxonomies_terms_links(); ?><span class="dash">&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo esc_html ( get_the_date() ); ?></p>
													<a href="<?php the_permalink(); ?>" class="btn btn-rounded m_t_50">Read More </a>
												</div>
											</div>
                                            
                                        </div>
                                    </div>
                                <?php else: ?>
                                    <div class="col-md-4 no-item">
                                        <div class="blog_body_box">
                                            <?php echo get_the_post_thumbnail(); ?>
                                            <div class="blog_content">
                                                <p> <?php echo custom_taxonomies_terms_links();?><span class="dash">&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo esc_html ( get_the_date() ); ?></p>
                                                <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
                                            </div>
                                        </div>
                                    </div>
                                <?php endif; ?>
                                <?php endwhile; ?>
                            </div>
                            <div class="row text-center">
                                <a href="#" id="loadMore" class="btn btn-rounded m_t_50">Load More</a>
                                <div class="messageAdd m_t_50">No More Publication Available</div>
                            </div>
                        </div>
                        <?php
                        wp_reset_postdata();
                    endif;
                    ?>
                </div>
                <div class="row   m_b_80   about_text">
                    <div class="title_text col-md-12 m_b_40">
                        <h3>Blog Posts</h3>
                    </div>
                    <?php
                    $query_args = array(
                        'post_type'      => 'post',
                        'posts_per_page'  => '-1',
                        'orderby' => 'date',
                        'order' => 'ASC',
                    );
                    $post_t = new WP_Query( $query_args );
                    $post_count = 0;
                    if($post_t->have_posts()): ?>
                        <div class="col-md-12 news_post">
                            <div class="row">
                                <?php while($post_t->have_posts()): $post_t->the_post(); $post_count++; ?>
                                    <?php if ($post_count == 1): ?>
                                        <div class="col-md-12">
                                            <div class="blog_title_box">
                                                <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
                                                <p><?php $user_info = get_userdata(1);
                                                    echo $user_info->first_name." ".$user_info->last_name;
													?><span class="dash">&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo custom_taxonomies_terms_links(); ?><span class="dash">&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo esc_html ( get_the_date() ); ?></p>
                                                <a href="<?php the_permalink(); ?>" class="btn btn-rounded m_t_50">Read More </a>
                                            </div>
                                        </div>
                                    <?php else: ?>
                                        <div class="col-md-4">
                                            <div class="blog_body_box">
                                                <?php echo get_the_post_thumbnail(); ?>
                                                <div class="blog_content">
													<p> <?php echo custom_taxonomies_terms_links();?><span class="dash">&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</span><?php echo esc_html ( get_the_date() ); ?></p>
                                                    <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                <?php endwhile; ?>
                            </div>
                            <div class="row text-center">
                                <a href="#" id="loadMore" class="btn btn-rounded m_t_50">Load More</a>
                                <div class="messageAdd m_t_50">No More Blog Posts Available</div>
                            </div>
                        </div>
                        <?php
                        wp_reset_postdata();
                    endif;
                    ?>
                </div>
            </div>
        </div>
    </section>

<?php
get_footer();
