ACC SHELL

Path : /srv/www/vhosts/laboserv/wp-content/themes/laboserv2020/
File Upload :
Current File : //srv/www/vhosts/laboserv/wp-content/themes/laboserv2020/index.php

<?php
/** 
 * @package WordPress
 * @subpackage Laboserv2020
 * @since Laboserv2020 1.0
 */

get_header(); ?>
	
	<div class="textarea">
		<div class="content">
	
		<section class="catalogues">
			<h1>Katalogy produktů</h1>
			<h2>Nabízený sortiment</h2>
			<?php 
			$args = array(
				'post_type'		=> 'page',
				'meta_key'   	=> 'main_page',
				'meta_value' 	=> true
				);	
		
		// Create the new query
		$loop = new WP_Query( $args );
		
		$loop->the_post();
		
		$mPageID = $loop->post->ID;
		
		$catalogues = array(
			array(
				'title' => get_field( 'catalogue1_title', $mPageID ),
				'picture' => get_field( 'catalogue1_picture', $mPageID ),
				'link' => get_field( 'catalogue1_link', $mPageID ),
				'size' => get_field( 'catalogue1_size', $mPageID )
				),
			array(
				'title' => get_field( 'catalogue2_title', $mPageID ),
				'picture' => get_field( 'catalogue2_picture', $mPageID ),
				'link' => get_field( 'catalogue2_link', $mPageID ),
				'size' => get_field( 'catalogue2_size', $mPageID )
				),
			array(
				'title' => get_field( 'catalogue3_title', $mPageID ),
				'picture' => get_field( 'catalogue3_picture', $mPageID ),
				'link' => get_field( 'catalogue3_link', $mPageID ),
				'size' => get_field( 'catalogue3_size', $mPageID )
				)			
		);
		
		foreach( $catalogues as $catalogue )
		{
			
				if ( empty( $catalogue[ 'picture' ] ) )
				{
					$picture = get_template_directory_uri().'/images/catalogue-empty.png';	
				}
				else
				{
					$picture = $catalogue[ 'picture' ][ 'sizes' ][ 'catalogue' ];
				}
				//print_r($catalogue[ 'picture' ]);
				echo '<div class="catalogue"><a href="'.$catalogue[ 'link' ].'" title="Stáhnout katalog '.$catalogue[ 'title' ].'"><img src="'.$picture.'" alt="'.$catalogue[ 'title' ].'" /></a><a href="'.$catalogue[ 'link' ].'" class="button"><span class="title">'.$catalogue[ 'title' ].'</span><span class="size">'.number_format( $catalogue[ 'size' ], 0, 0, ' ' ).' kB</span></a></div>';
				
		}			
		?>
			<div class="lshop-link">Kompletní sortiment a&nbsp;katalogové ceny najdete v&nbsp;našem e-shopu <a href="http://www.lshop.cz" target="_blank">LSHOP</a>.</div>
		</section><!-- .catalogues END -->
	
		<section class="advice">
		
			<?php
				$args = array(
				'post_type'			=> 'post',
				'posts_per_page'   	=> 1,
				'cat' 				=> 10
				);
				
				// Create the new query
				$advice = new WP_Query( $args );
		
				$advice->the_post();
		
				$adviceID = $advice->post->ID;
			
			?>
		
			<header>
				<h1><a href="<?php echo get_the_permalink( $adviceID ); ?>"><?php echo get_the_title( $adviceID ); ?></a></h1>
				<p class="date"><?php echo get_the_date( 'd. F Y', $adviceID ); ?></p>
			</header>
			<div class="excerpt">
				<p><?php echo get_the_excerpt( $adviceID ); ?> <a href="<?php echo get_the_permalink( $adviceID ); ?>">pokračovat...</a></p>
				<?php 
					$author = get_field( 'author', $adviceID );
					$big_photo = get_field( 'big_photo', $adviceID );
					if ( isset( $big_photo[ 'url' ] ) )
					{
						echo '<img src="'.$big_photo[ 'url' ].'" alt="'.$author.'" />';
					}
					/*if ( has_post_thumbnail( $adviceID ) )
					{
					//	echo get_the_post_thumbnail( $adviceID, 'adviceperson');
					}*/				
				?>
			</div>
			<footer>
				<p class="author"><?php echo $author; ?></p>
			</footer>		
		</section>
	
		</div><!-- .content END -->	
	</div><!-- #textarea END -->
	
	<section class="products">
	<div class="content">
	<div class="scrollable-area">
		<?php
			$args = array(
				'post_type'			=> 'post',
				'posts_per_page'   	=> 0,
				'category_name' 	=> 'produkty'
				);
				
				// Create the new query
				$products = new WP_Query( $args );
		
				// vypis produktu
				while ( $products->have_posts() )
				{
					$products->the_post();
					global $post;
					$productID = $post->ID;
					echo '<article class="product-item">';
					
					if (has_post_thumbnail( $productID ))
					{
						echo '<a href="'.get_the_permalink( $productID ).'">';
						echo  get_the_post_thumbnail($productID, 'productthmb');
						echo '</a>';
					}
					else
					{
						echo '<a href="'.get_the_permalink( $productID ).'"><img src="'.get_template_directory_uri().'/assets/images/placeholder.png" alt="ilustrační obrázek" /></a>';
					}
					
					echo '<h1><a href="'.get_the_permalink( $productID ).'">'.get_the_title( $productID ).'</a></h1>';
					
					echo '<p class="excerpt">'.get_the_excerpt( $productID ).'</p>';
					
					echo '</article>';					
				}
		?>	
	</div><!-- .scrollable-area END -->
	</div><!-- .content END -->
	</section><!-- .products END -->

<?php //get_sidebar(); 
get_template_part( 'supfooter' ); ?>
<?php get_footer(); ?>

ACC SHELL 2018