<?php
$args = array(

'order' => 'asc',
'orderby' => 'rand',
'posts_per_page' => 6,
'category_name' => 'pyrenees'

); ?>

<?php // the query
remove_all_filters('posts_orderby');
$the_query = new WP_Query( $args ); ?>

<!-- the loop -->
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> 
	<div class="open-postsbycategory-box">
	
	
	
	<?php if ( has_post_thumbnail() ) {the_post_thumbnail( 'img-postsbycategory' );  } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
	<?php if(get_field('feature_sub_title')) {
			echo '<h4>' . get_field('feature_sub_title') . '</h4>';} ?>
			
		<div class="excerpt">	
			<?php the_excerpt(); ?>
		</div>	
			
	<div class="linkbox"><a class="linkbox-button" href="<?php the_permalink(); ?>">Read more</a></div>

</div>

<!--mobile only -->
<div class="postsbycategory-box mobile-only">	
			<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('img-postsbycategory'); ?></a>

<div class="postsbycategory-overbox">
			<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
			<h4><?php
			$value = get_field( "feature_sub_title" );
			if( $value ) {
       		echo $value;
			} else {
		   echo '';
    
			}
			 ?></h4>
			
			
			<?php html5wp_excerpt('html5wp_index'); ?>
			
			<div class="read-more-container">
			<div class="read-more">
			<a href="<?php the_permalink(); ?>">Read more</a>
			</div>
			</div>

</div>
</div>

	 <?php endwhile; ?>
