<?php 
   /* 
   Template Name: Template - Rate by user
   */ 
global $opt_themes;
$paged_categorie_games			= (get_query_var('paged')) ? get_query_var('paged') : 1;  
get_header();
?>  


	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	?>
	<div id="content" class="site-content">
	<div class="container py-1">
	<div class=" mb-3" style="max-width:850px;"> 
	<ul id="breadcrumb" class="breadcrumb">
	<li class="breadcrumb-item home"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?>"><?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?></a></li>
	<?php printf( __( '%s', THEMES_NAMES ), '<li class="breadcrumb-item">' . get_the_title() . '</li>' ); ?> 
	</ul>
	</div>
	</div>
	<div class="container">	
	<div class="row">
	<?php 
	do_action('main_home');
	do_action('section_cust');
	?>
	<div class="row">
	<?php
	break; 	
	case 'modyolo':
	?>
	
	<div id="content" class="site-content">
	<div class="container py-1 ">
	<div class=" mb-3" > 	
	<ul id="breadcrumb" class="breadcrumb">
	<li class="breadcrumb-item home"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?>"><?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?></a></li>
	<?php printf( __( '%s', THEMES_NAMES ), '<li class="breadcrumb-item">' . get_the_title() . '</li>' ); ?> 
	</ul>
	</div>
	</div>
	<div class="container">	
	<div class="row">
	<?php 
	do_action('main_home');
	do_action('section_cust');
	?>
	<div class="row">
	
	<?php
	break; 	
	case 'reborn':
	?>
	<div id="content" class="site-content">
	<div class="container py-1">
	<div class=" mb-3" style="max-width:850px;"> 
	<ul id="breadcrumb" class="breadcrumb">
	<li class="breadcrumb-item home"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?>"><?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?></a></li>
	<?php printf( __( '%s', THEMES_NAMES ), '<li class="breadcrumb-item">' . get_the_title() . '</li>' ); ?> 
	</ul>
	</div>
	</div>
	<div class="container">	
	<div class="row">
	<?php 
	do_action('main_home');
	do_action('section_cust');
	?>
	<div class="row">
	
	<?php
	break; 	
	case 'liteapks':
	?>
	<div class="py-2"> 
	
	<div class="container py-1">
	<div class=" mb-3" style="max-width:850px;"> 
	<ul id="breadcrumb" class="breadcrumb">
	<li class="breadcrumb-item home"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?>"><?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?></a></li>
	<?php printf( __( '%s', THEMES_NAMES ), '<li class="breadcrumb-item">' . get_the_title() . '</li>' ); ?> 
	</ul>
	</div>
	</div>
	 
	</div>
	<div class="container"> 
	<h2 class="font-weight-bold mb-4"><?php the_title(); ?></h2> 
	<div class="row">
	
	<?php	
	break; 
	default:
	?>
	<div id="content" class="site-content">
	<div class="container py-1">
	<div class=" mb-3" style="max-width:850px;"> 
	<ul id="breadcrumb" class="breadcrumb">
	<li class="breadcrumb-item home"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?>"><?php _e($opt_themes['text_homes'], TEXT_DOMAIN); ?></a></li>
	<?php printf( __( '%s', THEMES_NAMES ), '<li class="breadcrumb-item">' . get_the_title() . '</li>' ); ?> 
	</ul>
	</div>
	<div class="container">	
	<div class="row">
	<?php 
	do_action('main_home');
	do_action('section_cust');
	?>
	<div class="row">
	
	<?php
	break; 
	}
	?>
	
	<?php
	query_posts( array(		 
		'post_type'			=> 'post',
		'meta_query'		=> array(
		'relation'			=> 'AND',
		'average_clause'	=> array(
			'key'			=> 'rmp_avg_rating',
			'compare'		=> 'EXISTS',
		),
		'count_clause'		=> array(
			'key'			=> 'rmp_vote_count',
			'compare'		=> 'EXISTS',
		),
		),
		'orderby'	=> array(
			'average_clause'	=> 'DESC',
			'count_clause'		=> 'DESC',
		),
		//'ignore_sticky_posts' => true
	));
	
	if (have_posts()) : while (have_posts()) : the_post();
	
	
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	get_template_part('loop/item.rate.mdr'); 
	break; 
	
	case 'modyolo':
	get_template_part('loop/item.rate.mdy'); 
	break; 
	
	case 'reborn':
	get_template_part('loop/item.rate.reborn');
	break; 
	
	case 'liteapks':
	get_template_part('loop/item.rate.liteapks');
	break; 
	
	default:
	get_template_part('loop/item.rate.mdr'); 
	break;
	}		
	endwhile; 
	wp_reset_postdata();
	endif; ?>
                
	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	?>
	</div>
	</section>
	<?php 
	get_template_part('include/nav'); 
	?>
	</main>
	<?php do_action('sidebar'); ?>
	</div>
	</div>
	</div>
	<?php
	break; 	
	case 'modyolo':
	?>
	</div>
	</section>
	<?php 
	get_template_part('include/nav'); 
	?>
	</main>
	<?php do_action('sidebar'); ?>
	
	</div>
	</div>
	<?php
	break; 	
	case 'reborn':
	?>
	</div>
	</section>
	<?php 
	get_template_part('include/nav'); 
	?>
	</main>
	<?php do_action('sidebar'); ?>
	
	</div>
	</div>
	<?php
	break; 	
	case 'liteapks':
	?>
	</div>
	</section>
	<?php get_template_part('include/nav'); ?>
	</div>
	<?php	
	break; 
	default:
	?>
	</div>
	</section>
	<?php 
	get_template_part('include/nav'); 
	?>
	</main>
	<?php do_action('sidebar'); ?>
	
	</div>
	</div>
	<?php
	break; 
	}
	?>
	
<?php
get_footer(); 