<?php
	get_header();
?>			
	<div class="container bg_top">
		<div class="row">
			<div class="content col-xs-12 col-md-8 col-lg-8">
				<div class="loop_content"> 
						<div class="post_loopads row">
						<div class="post_title"> <?=$categori->name ?> </div>
							<?php 
							$args = array(
								'posts_per_page' => 10,
								'orderby' => 'ASC',
								'paged' => $paged,
								'post_type' => 'obyavleniya',
							);

							$query = new WP_Query( $args );

							if ( $query->have_posts() ) {
								while ( $query->have_posts() ) {
									$query->the_post();?>

									<div class="content_post col-xs-12 col-md-12 col-lg-12">	
						<div class="post_top">	
							<div class="thumbnail_post">
								<a href="<?php the_permalink(); ?>">
									<?php the_post_thumbnail(); ?>
								</a>
							</div>	
								<div class="expert_title obyavleniya">	
									<a href="<?php the_permalink(); ?>">
										<div class="avatar"><?php echo get_avatar( get_the_author_email(), '60' ); ?></div>
										<div class="author"><?php echo get_the_author(); ?></div>
										<h2><?php the_title(); ?></h2>
									</a>
									<div class="expert">
										<?php echo wp_trim_words( get_the_content(), 35); ?>
									</div>
								</div>
						</div>			
					</div>
					<?php 
								}
							} else {
								// Постов не найдено
								echo '<p class="noposts">Рубрика в стадии наполнения!</p>';
							}
							wp_reset_postdata();?>
							</div>		
				</div>	
			</div>						
				<div id="pagination"><?php echo paginate_links(); ?></div>
				<!-- сайдбар -->
			<div class="content col-xs-12 col-md-4 col-lg-4">	

				<div class="login-form">
				<?php ulogin_synchronisation_panel(); ?>
				<?php echo get_ulogin_panel(); ?>
				</div>
				<?php 
            		if( !is_page('ads') and !current_user_can('subscriber') ){
                		echo '<div class="morelink_ads"><div class="morelink_adss">Подать объявление</div></div>';
              		}
              		else{
              			echo '<div class="morelink_ads2"><a href="'.home_url('/ads').'">Подать объявление</a></div>';
              		}		
            	?>
				<div class="row">
				<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
						<!-- SidebarAd -->
						<ins class="adsbygoogle"
						 	style="display:block"
						 	data-ad-client="ca-pub-7105617870736530"
						 	data-ad-slot="7383541917"
						 	data-ad-format="auto"></ins>
				<script>
						(adsbygoogle = window.adsbygoogle || []).push({});
				</script>
			</div>	
		</div>
	</div>
</div>					
<?php
	get_footer();
?>